threads / patch / 43277

patchAdd --bool and --int to the OPTIONS section

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

## tl;dr

4 messages between Nov 28, 2006 and Nov 29, 2006. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Andy Parkins· Nov 28, 2006, 12:02 UTC · lore

[PATCH] 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.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 git-commit.sh |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
Show changes to git-commit.sh +12 −3
diff --git a/git-commit.sh b/git-commit.sh
index 81c3a0c..c45af10 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -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
-- 
1.4.3.GIT-dirty
Junio C Hamano· Nov 28, 2006, 20:17 UTC · re: Andy Parkins · lore

Re: [PATCH] Add support for commit.signoff config option

Andy Parkins <andyparkins@gmail.com> writes:
Show 6 quoted lines
> 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.
>
> Signed-off-by: Andy Parkins <andyparkins@gmail.com>

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

Show 6 quoted lines
> +# 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'.
Andy Parkins· Nov 29, 2006, 08:25 UTC · re: Junio C Hamano · lore
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
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(-)
Show changes to Documentation/git-repo-config.txt +6 −0
diff --git a/Documentation/git-repo-config.txt 
b/Documentation/git-repo-config.txt
index 8199615..5bede9a 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -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
 -----------
-- 
1.4.3.GIT-dirty
Johannes Schindelin· Nov 29, 2006, 10:09 UTC · re: Andy Parkins · lore

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

Hi,
On Wed, 29 Nov 2006, Andy Parkins wrote:
> Signed-off-by: Andy Parkins <andyparkins@gmail.com>
> ---

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

> 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:
> 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

← back to recent threads