summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4017761)
raw | patch | inline | side by side (parent: 4017761)
author | Gerrit Pape <pape@smarden.org> | |
Fri, 6 Jul 2007 14:42:27 +0000 (14:42 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Jul 2007 01:24:19 +0000 (18:24 -0700) |
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>
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>
git-commit.sh | patch | blob | history |
diff --git a/git-commit.sh b/git-commit.sh
index 9106a743cc90f532be2c83d3a73799566b95df6a..f3cd8ee97839578bbfc719fd37d5b25b826623a8 100755 (executable)
--- a/git-commit.sh
+++ b/git-commit.sh
case "$signoff" in
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 |
- grep 'Signed-off-by:' >/dev/null || need_blank_before_signoff=yes
- {
- test -z "$need_blank_before_signoff" || echo
- git-var GIT_COMMITTER_IDENT | sed -e '
- s/>.*/>/
- s/^/Signed-off-by: /
- '
- } >>"$GIT_DIR"/COMMIT_EDITMSG
+ grep 'Signed-off-by:' >/dev/null || blank_before_signoff='
+'
+ tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
+ grep "$sign"$ >/dev/null ||
+ printf '%s%s\n' "$blank_before_signoff" "$sign" \
+ >>"$GIT_DIR"/COMMIT_EDITMSG
;;
esac