Skip to contentSkip to conversation

dim: use quotes when testing for empty string

PATCH In review Paulo Zanoni 3 participants 5 messages Dec 3, 2015 – Dec 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dim: use quotes when testing for empty string

Today I applied/pushed patches for the first time, and noticed that all my commits had exactly this:

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@panetone:~/nfs/teste$ cat test.sh
    #!/bin/bash
    A=""
    if [ -n $A ]; then
        echo "No quotes: true"
    else
        echo "No quotes: false"
    fi
    if [ -n "$A" ]; then
        echo "With quotes: true"
    else
        echo "With quotes: false"
    fi
    pzanoni@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.

---
 dim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
dim +3 -1
index 78b3f30..5f2f686 100755
@@ -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."
 	fi
 
 	eval $DRY $DIM_POST_APPLY_ACTION
Signature · 6 lines
2.6.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 dim: add a QUICKSTART section to dim.rst

Because just running dim help doesn't give you the greater picture of the workflow. All the text here is based on an email written by Daniel Vetter, so the credits go to him. Any mistakes were introduced by me.

Credits-to: Daniel Vetter <[email protected]>

---
 dim.rst | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
dim.rst +58 -0
index d5ec5c8..567bcb8 100644
@@ -309,6 +309,64 @@ DIM_TEMPLATE_SIGNATURE
 ----------------------
 Path to a file containing a signature template for pull request mails.
 
+QUICKSTART
+==========
+
+For getting started grab the latest drm (drm-intel-maintainer) script from::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dim?h=maintainer-tools
+
+There's also a sample config file for ~/.dimrc::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dimrc.sample?h=maintainer-tools
+
+Plus, there's bash completion in the same directory if you feel like using that.
+Run::
+
+    $ dim help
+
+for tons of details about this thing works. Adjust your .dimrc to match your
+setup and then run::
+
+    $ dim setup
+
+This will also check out the latest maintainer-tools branches, so please replace
+the dim you just downloaded with a symlink after this step. And by the way, if
+you have improvements for dim, please submit them to intel-gfx.
+
+You should now have a main repository for patch application. The directory
+corresponding to this repository is defined by DIM_DRM_INTEL in your .dimrc.
+You should also have directories called maintainer-tools, drm-intel-nightly (for
+rebuilding the tree), and drm-intel-rerere for some dim-internal book-keeping.
+
+Applying patches to dinq is done in the main repository with::
+
+    $ cat patch.mbox | dim apply-queued
+
+This works like a glorified version of git apply-mbox and does basic patch
+checking and adds stuff like patchwork links of the merged patch. It is
+preferred to use the patch email file instead of the original patch file since
+it contains some interesting headers like the message ID. When you're happy
+(remember that with a shared tree any mistake is permanent and there's no
+rebasing) push out the new tree with::
+
+    $ dim push-queued
+
+This will also rebuild a new drm-intel-nightly integration tree. If that fails,
+ask maintainers for help with resolving conflicts. One thing to note here is
+that the script syncs saved git rerere conflict resolutions around. One does the
+resolution, everyone has it. The drawback is, someone screws up the conflict
+resolution, everyone has it...
+
+Note that every two weeks Daniel cuts a new drm-intel-next by tagging what's in
+drm-intel-next-queued. To increase the chances that the tree isn't totally
+broken, only push bug fixes for serious problems on Thu/Fri (and weekend) every
+second week (at the moment the release cycle is aligned with odd work weeks, but
+just check out when the last tagged happened).
+
+If you need to push something to drm-intel-fixes or
+drm-intel-next-fixes, please quickly coordinate with Jani.
+
 CONTRIBUTING
 ============
 
Signature · 6 lines
2.6.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [maintainer-tools PATCH 2/2] dim: add a QUICKSTART section to dim.rst

Quoted 3 lines · Paulo Zanoni

Because just running dim help doesn't give you the greater picture of the workflow. All the text here is based on an email written by Daniel Vetter, so the credits go to him. Any mistakes were introduced by me.

We could bikeshed the text ad infinitum, but this is better than nothing, and can be improved upon. LGTM.

BR,
Jani.

PS. I did reply with "reviewed-by" on the previous patch, but we haven't really tracked those for maintainer tools. Just getting an ack/lgtm is enough.

Quoted 75 lines

Credits-to: Daniel Vetter <[email protected]>

---
 dim.rst | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
dim.rst +58 -0
index d5ec5c8..567bcb8 100644
@@ -309,6 +309,64 @@ DIM_TEMPLATE_SIGNATURE
 ----------------------
 Path to a file containing a signature template for pull request mails.
 
+QUICKSTART
+==========
+
+For getting started grab the latest drm (drm-intel-maintainer) script from::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dim?h=maintainer-tools
+
+There's also a sample config file for ~/.dimrc::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dimrc.sample?h=maintainer-tools
+
+Plus, there's bash completion in the same directory if you feel like using that.
+Run::
+
+    $ dim help
+
+for tons of details about this thing works. Adjust your .dimrc to match your
+setup and then run::
+
+    $ dim setup
+
+This will also check out the latest maintainer-tools branches, so please replace
+the dim you just downloaded with a symlink after this step. And by the way, if
+you have improvements for dim, please submit them to intel-gfx.
+
+You should now have a main repository for patch application. The directory
+corresponding to this repository is defined by DIM_DRM_INTEL in your .dimrc.
+You should also have directories called maintainer-tools, drm-intel-nightly (for
+rebuilding the tree), and drm-intel-rerere for some dim-internal book-keeping.
+
+Applying patches to dinq is done in the main repository with::
+
+    $ cat patch.mbox | dim apply-queued
+
+This works like a glorified version of git apply-mbox and does basic patch
+checking and adds stuff like patchwork links of the merged patch. It is
+preferred to use the patch email file instead of the original patch file since
+it contains some interesting headers like the message ID. When you're happy
+(remember that with a shared tree any mistake is permanent and there's no
+rebasing) push out the new tree with::
+
+    $ dim push-queued
+
+This will also rebuild a new drm-intel-nightly integration tree. If that fails,
+ask maintainers for help with resolving conflicts. One thing to note here is
+that the script syncs saved git rerere conflict resolutions around. One does the
+resolution, everyone has it. The drawback is, someone screws up the conflict
+resolution, everyone has it...
+
+Note that every two weeks Daniel cuts a new drm-intel-next by tagging what's in
+drm-intel-next-queued. To increase the chances that the tree isn't totally
+broken, only push bug fixes for serious problems on Thu/Fri (and weekend) every
+second week (at the moment the release cycle is aligned with odd work weeks, but
+just check out when the last tagged happened).
+
+If you need to push something to drm-intel-fixes or
+drm-intel-next-fixes, please quickly coordinate with Jani.
+
 CONTRIBUTING
 ============
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [maintainer-tools PATCH 2/2] dim: add a QUICKSTART section to dim.rst

Em Sex, 2015-12-04 às 10:40 +0200, Jani Nikula escreveu:

Quoted 11 lines · Paulo Zanoni
Quoted 6 lines

Because just running dim help doesn't give you the greater picture of
the workflow. All the text here is based on an email written by Daniel
Vetter, so the credits go to him. Any mistakes were introduced by me.

We could bikeshed the text ad infinitum, but this is better than nothing, and can be improved upon. LGTM.

Quoted 8 lines

BR,
Jani.

PS. I did reply with "reviewed-by" on the previous patch, but we haven't
really tracked those for maintainer tools. Just getting an ack/lgtm is
enough.

Pushed both patches. Daniel also Acked the patches on IRC last Friday.

Thanks for the reviews!

Quoted 95 lines
Quoted 95 lines

Credits-to: Daniel Vetter <[email protected]>

---
 dim.rst | 58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 1 file changed, 58 insertions(+)
dim.rst +0 -0
index d5ec5c8..567bcb8 100644
@@ -309,6 +309,64 @@ DIM_TEMPLATE_SIGNATURE

 ----------------------
 Path to a file containing a signature template for pull request mails.

dim.rst +4 -0
+QUICKSTART
+==========
+
+For getting started grab the latest drm (drm-intel-maintainer)

script from::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dim?h=maintainer-to
ols

dim.rst +4 -0
+
+There's also a sample config file for ~/.dimrc::
+
+    http://cgit.freedesktop.org/drm-intel/tree/dimrc.sample?h=main

tainer-tools

dim.rst +2 -0
+
+Plus, there's bash completion in the same directory if you feel

like using that.

dim.rst +5 -0
+Run::
+
+    $ dim help
+
+for tons of details about this thing works. Adjust your .dimrc to

match your

dim.rst +5 -0
+setup and then run::
+
+    $ dim setup
+
+This will also check out the latest maintainer-tools branches, so

please replace
+the dim you just downloaded with a symlink after this step. And by the way, if

dim.rst +3 -0
+you have improvements for dim, please submit them to intel-gfx.
+
+You should now have a main repository for patch application. The

directory
+corresponding to this repository is defined by DIM_DRM_INTEL in your .dimrc.
+You should also have directories called maintainer-tools, drm- intel-nightly (for
+rebuilding the tree), and drm-intel-rerere for some dim-internal book-keeping.

dim.rst +6 -0
+
+Applying patches to dinq is done in the main repository with::
+
+    $ cat patch.mbox | dim apply-queued
+
+This works like a glorified version of git apply-mbox and does

basic patch
+checking and adds stuff like patchwork links of the merged patch. It is
+preferred to use the patch email file instead of the original patch file since
+it contains some interesting headers like the message ID. When you're happy
+(remember that with a shared tree any mistake is permanent and there's no

dim.rst +5 -0
+rebasing) push out the new tree with::
+
+    $ dim push-queued
+
+This will also rebuild a new drm-intel-nightly integration tree.

If that fails,
+ask maintainers for help with resolving conflicts. One thing to note here is
+that the script syncs saved git rerere conflict resolutions around. One does the
+resolution, everyone has it. The drawback is, someone screws up the conflict

dim.rst +3 -0
+resolution, everyone has it...
+
+Note that every two weeks Daniel cuts a new drm-intel-next by

tagging what's in
+drm-intel-next-queued. To increase the chances that the tree isn't totally
+broken, only push bug fixes for serious problems on Thu/Fri (and weekend) every
+second week (at the moment the release cycle is aligned with odd

Quoted 9 lines
Quoted 8 lines

work weeks, but

dim.rst +5 -0
+just check out when the last tagged happened).
+
+If you need to push something to drm-intel-fixes or
+drm-intel-next-fixes, please quickly coordinate with Jani.
+

 CONTRIBUTING
 ============

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/2
#4 lore raw
In reply to Paulo Zanoni
Quoted 7 lines · Paulo Zanoni

Today I applied/pushed patches for the first time, and noticed that all my commits had exactly this:

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.

Yes, the whole idea of the Link: tag was to increase transparency about people only applying patches that went throught the list.

Quoted 46 lines

The problem happened due to missing quotes around $message_id:

    pzanoni@panetone:~/nfs/teste$ cat test.sh
    #!/bin/bash
    A=""
    if [ -n $A ]; then
        echo "No quotes: true"
    else
        echo "No quotes: false"
    fi
    if [ -n "$A" ]; then
        echo "With quotes: true"
    else
        echo "With quotes: false"
    fi
    pzanoni@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.

---
 dim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
dim +3 -1
index 78b3f30..5f2f686 100755
@@ -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."
 	fi
 
 	eval $DRY $DIM_POST_APPLY_ACTION
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx