git-commit: don't add multiple Signed-off-by: from the same identity
If requested to signoff a commit, don't add another Signed-off-by: line to the commit message if the exact same line is already there. This was noticed and requested by Josh Triplett through http://bugs.debian.org/430851 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4017761fd8
commit
a7342913e2
@ -458,16 +458,18 @@ fi | git stripspace >"$GIT_DIR"/COMMIT_EDITMSG
|
|||||||
|
|
||||||
case "$signoff" in
|
case "$signoff" in
|
||||||
t)
|
t)
|
||||||
need_blank_before_signoff=
|
sign=$(git-var GIT_COMMITTER_IDENT | sed -e '
|
||||||
|
s/>.*/>/
|
||||||
|
s/^/Signed-off-by: /
|
||||||
|
')
|
||||||
|
blank_before_signoff=
|
||||||
tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
|
tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
|
||||||
grep 'Signed-off-by:' >/dev/null || need_blank_before_signoff=yes
|
grep 'Signed-off-by:' >/dev/null || blank_before_signoff='
|
||||||
{
|
'
|
||||||
test -z "$need_blank_before_signoff" || echo
|
tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
|
||||||
git-var GIT_COMMITTER_IDENT | sed -e '
|
grep "$sign"$ >/dev/null ||
|
||||||
s/>.*/>/
|
printf '%s%s\n' "$blank_before_signoff" "$sign" \
|
||||||
s/^/Signed-off-by: /
|
>>"$GIT_DIR"/COMMIT_EDITMSG
|
||||||
'
|
|
||||||
} >>"$GIT_DIR"/COMMIT_EDITMSG
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user