[Intel-gfx] [maintainer-tools PATCH 1/2] dim: use quotes when testing for empty string

Paulo Zanoni paulo.r.zanoni at intel.com
Thu Dec 3 11:40:50 PST 2015

Today I applied/pushed patches for the first time, and noticed that
all my commits had exactly this:
    Link: http://patchwork.freedesktop.org/patch/msgid/
without the actual ID there. I assumed the ID would be set by some
commit hook since our hooks seem to be able to talk to patchwork.
Looks like I was wrong. It seems that I was supposed to apply a patch
email, not the original patch file that I sent with git send-email.

The problem happened due to missing quotes around $message_id:

    pzanoni at panetone:~/nfs/teste$ cat test.sh
    if [ -n $A ]; then
        echo "No quotes: true"
        echo "No quotes: false"
    if [ -n "$A" ]; then
        echo "With quotes: true"
        echo "With quotes: false"
    pzanoni at panetone:~/nfs/teste$ bash test.sh
    No quotes: true
    With quotes: false

In addition, print a little message telling us that the message-ids
are missing. This may help by reminding us that we should apply the
mail file, not the original patch. I'm not enforcing it since I don't
know all our use cases.

Cc: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
 dim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index 78b3f30..5f2f686 100755
--- a/dim
+++ b/dim
@@ -382,8 +382,10 @@ function dim_apply
 	cat $file | git am -3 "$@"
-	if [ -n $message_id ]; then
+	if [ -n "$message_id" ]; then
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
+	else
+		echo "No message-id found in the patch file."

More information about the Intel-gfx mailing list