Skip to contentSkip to conversation

Add support for commit.signoff config option

PATCH In review Andy Parkins 3 participants 4 messages Aug 11, 2016 Documentation

lore
Share & tools
lore
#2 lore raw

PATCH 1/1 Add --bool and --int to the OPTIONS section

In reply to Junio C Hamano

---
I did look for just such an option, but didn't find it because it wasn't in the OPTIONS list of the git-repo-config man page. If there is an OPTIONS section it should include all options, otherwise it's no use as a quick reference.

Your template commit message is an excellent idea, but I don't like the idea of simply hard coding sign off line into it; it means that there are then two locations in the .git tree that I'd have to edit to change my name. Therefore any template would have to support token expansion so that "S-o-B:
$REPOSITORY_EMAIL" would be possible. Even better would be support for "$GIT_STATUS_OUTPUT" and "$GIT_DIFF_OUTPUT" so that the commit message is completely templated.

 Documentation/git-repo-config.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/Documentation/git-repo-config.txt
index 8199615..5bede9a 100644

Documentation/git-repo-config.txt +6 -0
@@ -77,6 +77,12 @@ OPTIONS
 -l, --list::
 	List all variables set in config file.
 
+--bool::
+	git-repo-config will ensure that the output is "true" or "false"
+
+--int::
+	git-repo-config will ensure that the output is a simple decimal number
+
 
 ENVIRONMENT
 -----------
Signature · 1 line
1.4.3.GIT-dirty
#1 lore raw
In reply to Andy Parkins
Quoted 6 lines · Andy Parkins

Whether patches require signing off or not is probably a per-project setting rather than a per-commit setting. Therefore as a convenience to the user, the commit.signoff setting will automtically add --signoff to commits.

I muttered something about commit templates which would make this change a moot point, but independent of that...

git-commit.sh signoff= · line 92

Quoted 6 lines
git-commit.sh +6 -0
+# Config
+case "$(git-repo-config --get commit.signoff)" in
+1|on|yes|true)
+	signoff=t
+	;;
+esac

this is ugly; please use --bool and check only for 'true'.

#3 lore raw

Re: [PATCH] Add --bool and --int to the OPTIONS section

In reply to Andy Parkins

Hi,

Quoted 2 lines · Andy Parkins

---

You might want to use a more-to-the-point subject, and move this into the commit message:

Quoted 4 lines

I did look for just such an option, but didn't find it because it wasn't in the OPTIONS list of the git-repo-config man page. If there is an OPTIONS section it should include all options, otherwise it's no use as a quick reference.

And this belongs into another mail:

Quoted 4 lines

Your template commit message is an excellent idea, but I don't like the idea of simply hard coding sign off line into it; it means that there are then two locations in the .git tree that I'd have to edit to change my name. [...]

But to answer your concern: you would do this as a hook, which is a script in which you do not put your name directly. Rather, this script gets the current author name by calling either git-var or git-repo-config.

Ciao,
Dscho

#0 lore raw

PATCH 1/1 Add support for commit.signoff config option

Whether patches require signing off or not is probably a per-project setting rather than a per-commit setting. Therefore as a convenience to the user, the commit.signoff setting will automtically add --signoff to commits.

---

 git-commit.sh |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
git-commit.sh +12 -3
index 81c3a0c..c45af10 100755
@@ -66,9 +66,7 @@ trap '
 	rm -f "$NEXT_INDEX"
 ' 0
 
-################################################################
-# Command line argument parsing and sanity checking
-
+# Init
 all=
 also=
 only=
@@ -85,6 +83,17 @@ signoff=
 force_author=
 only_include_assumed=
 untracked_files=
+
+# Config
+case "$(git-repo-config --get commit.signoff)" in
+1|on|yes|true)
+	signoff=t
+	;;
+esac
+
+################################################################
+# Command line argument parsing and sanity checking
+
 while case "$#" in 0) break;; esac
 do
 	case "$1" in
Signature · 1 line
1.4.3.GIT-dirty