git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity
@ 2007-07-06 14:42 Gerrit Pape
  2007-07-06 14:45 ` [PATCH] git-commit: add commit.signoff config option Gerrit Pape
  2007-07-06 18:11 ` [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Gerrit Pape @ 2007-07-06 14:42 UTC (permalink / raw)
  To: Junio C Hamano, git

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>
---
 git-commit.sh |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index f866f95..7a7d19a 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -458,16 +458,18 @@ fi | git stripspace >"$GIT_DIR"/COMMIT_EDITMSG
 
 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
 
-- 
1.5.2.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] git-commit: add commit.signoff config option
  2007-07-06 14:42 [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Gerrit Pape
@ 2007-07-06 14:45 ` Gerrit Pape
  2007-07-06 18:11 ` [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Gerrit Pape @ 2007-07-06 14:45 UTC (permalink / raw)
  To: Junio C Hamano, git

Have the commit.signoff boolean config option automatically add a
Signed-off-by: by git-commit, without giving the -s switch explicitly.

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 git-commit.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index 7a7d19a..b493820 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -275,6 +275,7 @@ $1"
 	esac
 done
 case "$edit_flag" in t) no_edit= ;; esac
+test "$(git config --bool commit.signoff)" != true || signoff=t
 
 ################################################################
 # Sanity check options
-- 
1.5.2.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity
  2007-07-06 14:42 [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Gerrit Pape
  2007-07-06 14:45 ` [PATCH] git-commit: add commit.signoff config option Gerrit Pape
@ 2007-07-06 18:11 ` Junio C Hamano
  2007-07-08 15:00   ` Gerrit Pape
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-07-06 18:11 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git

If you are trying to avoid a run of Signed-off-by: lines like this:

	Signed-off-by: Original Author <oa@example.com>
	Signed-off-by: First Reviewer <fr@example.com>
	Signed-off-by: Second Reviewer <sr@example.com>
	Signed-off-by: Original Author <oa@example.com>
	Signed-off-by: Subsystem Integrator <si@example.com>

It is not a bug.  If the last signed-off-by is not from
yourself, your signed-off-by is added when you ask with "-s",
and this is very much intentionally done to follow the existing
practice of patch passing done in the kernel community, where
Signed-off-by: was invented (Linus or somebody from the kernel
circle can correct me if I am wrong).

When you are passing patches around, tweaks to the patch
contents can be made.  If your patch comes back to you from the
second reviewer, it is not what you originally sent out.  You
would want to sign it off again.

We have deliberately excluded what your other patch tries to do
for a reason.  Even though these lines are not digitally signed,
the intent of adding a Signed-off-by: line with your name is
that you are certifying its origin, according to the definition
of DCO (see Documentation/SubmittingPatches).  This should be a
conscious act from the signer's part, and making it automatic
with a config variable that you set once and forget makes it
much less meaningful.



        

        

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity
  2007-07-06 18:11 ` [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Junio C Hamano
@ 2007-07-08 15:00   ` Gerrit Pape
  2007-07-08 18:44     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Gerrit Pape @ 2007-07-08 15:00 UTC (permalink / raw)
  To: Junio C Hamano, git

On Fri, Jul 06, 2007 at 11:11:48AM -0700, Junio C Hamano wrote:
> If you are trying to avoid a run of Signed-off-by: lines like this:
> 
> 	Signed-off-by: Original Author <oa@example.com>
> 	Signed-off-by: First Reviewer <fr@example.com>
> 	Signed-off-by: Second Reviewer <sr@example.com>
> 	Signed-off-by: Original Author <oa@example.com>
> 	Signed-off-by: Subsystem Integrator <si@example.com>
> 
> It is not a bug.  If the last signed-off-by is not from
> yourself, your signed-off-by is added when you ask with "-s",

This is what the patch does, it only checks against the final line,
sorry, the subject is incorrect.  The behavior currently is

 $ ./git-commit -m foo foo
 Created commit 2fad03e: foo
  0 files changed, 0 insertions(+), 0 deletions(-)
  create mode 100644 foo
 $ EDITOR=cat ./git-commit --amend -s foo |head -n4
 foo

 Signed-off-by: Gerrit Pape <pape@smarden.org>

 $ EDITOR=cat ./git-commit --amend -s foo |head -n4
 foo

 Signed-off-by: Gerrit Pape <pape@smarden.org>
 Signed-off-by: Gerrit Pape <pape@smarden.org>
 $ 

with the patch, iff the last line already was the signoff to be added,
it won't be added again.

> We have deliberately excluded what your other patch tries to do
> for a reason.  Even though these lines are not digitally signed,
> the intent of adding a Signed-off-by: line with your name is
> that you are certifying its origin, according to the definition
> of DCO (see Documentation/SubmittingPatches).  This should be a
> conscious act from the signer's part, and making it automatic
> with a config variable that you set once and forget makes it
> much less meaningful.

Okay, to me personally it would be convenient, for the git repository I
have no problem with, and want to simply singoff all commits, for other
repos none.

Regards, Gerrit.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity
  2007-07-08 15:00   ` Gerrit Pape
@ 2007-07-08 18:44     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-07-08 18:44 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git

Gerrit Pape <pape@smarden.org> writes:

> with the patch, iff the last line already was the signoff to be added,
> it won't be added again.

Ah, I completely misread the patch.  Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-08 18:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06 14:42 [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Gerrit Pape
2007-07-06 14:45 ` [PATCH] git-commit: add commit.signoff config option Gerrit Pape
2007-07-06 18:11 ` [PATCH] git-commit: don't add multiple Signed-off-by: from the same identity Junio C Hamano
2007-07-08 15:00   ` Gerrit Pape
2007-07-08 18:44     ` Junio C Hamano

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).