* [PATCH RFC v2] git-am: support any number of signatures
@ 2014-06-18 4:34 Michael S. Tsirkin
0 siblings, 0 replies; only message in thread
From: Michael S. Tsirkin @ 2014-06-18 4:34 UTC (permalink / raw)
To: git; +Cc: gitster
I'm using different signature tags for git am depending on the patch,
project and other factors.
Sometimes I add multiple tags as well, e.g. QEMU
wants both Reviewed-by and Signed-off-by tags.
This patch makes it easy to do so:
1. new parameter am.signoff can be used any number
of times:
[am]
signoff = "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>"
Will add reviewed by tag in addition to the S.O.B.
if set all signatures are picked up when git am -s is used.
2. Any number of alternative signatures
[am "a"]
signoff = "Acked-by: Michael S. Tsirkin <mst@redhat.com>"
[am "t"]
signoff = "Tested-by: Michael S. Tsirkin <mst@redhat.com>"
if set the signature type can be specified by passing
a parameter to the -s flag:
git am -sa
A combination is supported:
git am -sa -st
No docs or tests, sorry, so not yet ready for master, but I'm using this
all the time without any issues so maybe ok for pu.
Early flames/feedback/help welcome.
Changes from v1:
Address Junio's feedback:
Default signature is always applied.
This is to make it a no-brainer for people to track using DCO.
De-duplication fixed (works for default signature only
as other signatures might make sense multiple times).
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
git-am.sh | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index ee61a77..c1246e6 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -13,7 +13,7 @@ i,interactive run interactively
b,binary* (historical option -- no-op)
3,3way allow fall back on 3way merging if needed
q,quiet be quiet
-s,signoff add a Signed-off-by line to the commit message
+s,signoff? add a Signed-off-by line to the commit message
u,utf8 recode into utf8 (default)
k,keep pass -k flag to git-mailinfo
keep-non-patch pass -b flag to git-mailinfo
@@ -383,6 +383,7 @@ then
keepcr=t
fi
+signoffs=
while test $# != 0
do
case "$1" in
@@ -394,8 +395,15 @@ it will be removed. Please do not use it anymore."
;;
-3|--3way)
threeway=t ;;
- -s|--signoff)
- sign=t ;;
+ --signoff)
+ sign=t
+ s=$(git config --get-all am.signoff)
+ signoffs=("${signoffs[@]}" "${s[@]}") ;;
+ --signoff=*)
+ sign=t
+ a="${1#--signoff=}"
+ s=$(git config --get-all am."${a}".signoff)
+ signoffs=("${signoffs[@]}" "${s[@]}") ;;
-u|--utf8)
utf8=t ;; # this is now default
--no-utf8)
@@ -642,6 +650,16 @@ then
threeway=t
fi
git_apply_opt=$(cat "$dotest/apply-opt")
+EXTRA_SIGNOFFS=
+for ack in "${signoffs[@]}"; do
+ if test "$EXTRA_SIGNOFFS"
+ then
+ EXTRA_SIGNOFFS=$(printf "%s\n%s" "$SIGNOFF" "$ack")
+ else
+ EXTRA_SIGNOFFS="$ack"
+ fi
+done
+
if test "$(cat "$dotest/sign")" = t
then
SIGNOFF=$(git var GIT_COMMITTER_IDENT | sed -e '
@@ -744,13 +762,13 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
"$dotest/msg-clean" |
sed -ne '$p'
)
- ADD_SIGNOFF=$(
+ ADD_SIGNOFF="$EXTRA_SIGNOFFS"$(
test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
test '' = "$LAST_SIGNED_OFF_BY" && echo
echo "$SIGNOFF"
})
else
- ADD_SIGNOFF=
+ ADD_SIGNOFF="$EXTRA_SIGNOFFS"
fi
{
if test -s "$dotest/msg-clean"
--
MST
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-06-18 4:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 4:34 [PATCH RFC v2] git-am: support any number of signatures Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).