dim: turn commit-add-tag into a proper dim subcommand
PATCH 1/1 dim: turn commit-add-tag into a proper dim subcommand
This lets you add e.g. review tags to a commit on the command line:
$ dim commit-add-tag "Reviewed-by: Ville Syrjälä <[email protected]>"
This could be used as a building block for further scripting.
--- dim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
dim +10 -9
@@ -183,15 +183,16 @@ if message_id is not None: EOF } -# append a new tag at the end of the commit message of HEAD -# $1 = tag, $2 = value -commit_add_tag () +# append all arguments as tags at the end of the commit message of HEAD +function dim_commit_add_tag { - # the first sed deletes all trailing blank lines at the end - git log -1 --pretty=%B | \ - sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ - sed "\$a$1: $2" | \ - git commit --amend -F- + for arg; do + # the first sed deletes all trailing blank lines at the end + git log -1 --pretty=%B | \ + sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ + sed "\$a${arg}" | \ + git commit --amend -F- + done } function update_linux_next
@@ -427,7 +428,7 @@ function dim_apply_branch cat $file | git am -3 $sob "$@" if [ -n "$message_id" ]; then - commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id" + dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id" else echo "No message-id found in the patch file." fi
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Jani Nikula
This lets you add e.g. review tags to a commit on the command line:
$ dim commit-add-tag "Reviewed-by: Ville Syrjälä <[email protected]>"This could be used as a building block for further scripting.
Signed-off-by Jani Nikula <[email protected]>
Is the grand plan to add this to dim apply-resolved too? Just realized again that we don't yet add them ...
Ack.
-Daniel
Quoted 49 lines
--- dim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)dim +10
-9@@ -183,15 +183,16 @@ if message_id is not None: EOF } -# append a new tag at the end of the commit message of HEAD -# $1 = tag, $2 = value -commit_add_tag () +# append all arguments as tags at the end of the commit message of HEAD +function dim_commit_add_tag { - # the first sed deletes all trailing blank lines at the end - git log -1 --pretty=%B | \ - sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ - sed "\$a$1: $2" | \ - git commit --amend -F- + for arg; do + # the first sed deletes all trailing blank lines at the end + git log -1 --pretty=%B | \ + sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ + sed "\$a${arg}" | \ + git commit --amend -F- + done } function update_linux_next@@ -427,7 +428,7 @@ function dim_apply_branch cat $file | git am -3 $sob "$@" if [ -n "$message_id" ]; then - commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id" + dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id" else echo "No message-id found in the patch file." fiSignature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines · Daniel Vetter
[ text/plain ]
Quoted 2 lines · Jani Nikula
This lets you add e.g. review tags to a commit on the command line:
Quoted 8 lines
Quoted 5 lines
$ dim commit-add-tag "Reviewed-by: Ville Syrjälä <[email protected]>"This could be used as a building block for further scripting.
Signed-off-by Jani Nikula <[email protected]>Is the grand plan to add this to dim apply-resolved too? Just realized again that we don't yet add them ...
I didn't really have a grand plan, and I've never used apply-resolved...
Anyway, it's kind of tricky because at that point we've already lost the message-id.
BR,
Jani.
Quoted 53 lines
Ack.
-DanielQuoted 49 lines
--- dim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)dim +10
-9@@ -183,15 +183,16 @@ if message_id is not None: EOF } -# append a new tag at the end of the commit message of HEAD -# $1 = tag, $2 = value -commit_add_tag () +# append all arguments as tags at the end of the commit message of HEAD +function dim_commit_add_tag { - # the first sed deletes all trailing blank lines at the end - git log -1 --pretty=%B | \ - sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ - sed "\$a$1: $2" | \ - git commit --amend -F- + for arg; do + # the first sed deletes all trailing blank lines at the end + git log -1 --pretty=%B | \ + sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ + sed "\$a${arg}" | \ + git commit --amend -F- + done } function update_linux_next@@ -427,7 +428,7 @@ function dim_apply_branch cat $file | git am -3 $sob "$@" if [ -n "$message_id" ]; then - commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id" + dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id" else echo "No message-id found in the patch file." fiSignature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx