* [GSoC][PATCH v2] commit: add a commit.signOff config variable
@ 2018-02-05 10:40 Chen Jingpiao
2018-02-05 19:22 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Chen Jingpiao @ 2018-02-05 10:40 UTC (permalink / raw)
To: git; +Cc: sunshine, Chen Jingpiao
Add the commit.signOff configuration variable to use the -s or --signoff
option of git commit by default.
Convenience for those who prefer to add Signed-off-by line by the committer
instead of using format.signOff variable.
Signed-off-by: Chen Jingpiao <chenjingpiao@gmail.com>
---
Previous version of the patch:
[v1]: https://public-inbox.org/git/20180204020318.4363-1-chenjingpiao@gmail.com/
Changes in v2:
* Update commit message: Move commentary explains to commit message.
* Update test: Just test two combinations.
Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Documentation/config.txt | 4 ++++
Documentation/git-commit.txt | 2 ++
builtin/commit.c | 4 ++++
t/t7501-commit.sh | 10 ++++++++++
4 files changed, 20 insertions(+)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 0e25b2c92..5dec3f0cb 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1303,6 +1303,10 @@ commit.gpgSign::
convenient to use an agent to avoid typing your GPG passphrase
several times.
+commit.signOff::
+ A boolean value which lets you enable the `-s/--signoff` option of
+ `git commit` by default. See linkgit:git-commit[1].
+
commit.status::
A boolean to enable/disable inclusion of status information in the
commit message template when using an editor to prepare the commit
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index f970a4342..7a28ea765 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -166,6 +166,8 @@ The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`.
the rights to submit this work under the same license and
agrees to a Developer Certificate of Origin
(see http://developercertificate.org/ for more information).
+ See the `commit.signOff` configuration variable in
+ linkgit:git-config[1].
-n::
--no-verify::
diff --git a/builtin/commit.c b/builtin/commit.c
index 4610e3d8e..324213254 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1548,6 +1548,10 @@ static int git_commit_config(const char *k, const char *v, void *cb)
sign_commit = git_config_bool(k, v) ? "" : NULL;
return 0;
}
+ if (!strcmp(k, "commit.signoff")) {
+ signoff = git_config_bool(k, v);
+ return 0;
+ }
if (!strcmp(k, "commit.verbose")) {
int is_bool;
config_commit_verbose = git_config_bool_or_int(k, v, &is_bool);
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index fa61b1a4e..adaaeea5b 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -505,6 +505,16 @@ Myfooter: x" &&
test_cmp expected actual
'
+test_expect_success 'commit.signoff=true & --signoff omitted' '
+ git -c commit.signoff=true commit --allow-empty -m x &&
+ git log -1 --format=%B | grep ^Signed-off-by:
+'
+
+test_expect_success 'commit.signoff=true & --no-signoff' '
+ git -c commit.signoff=true commit --allow-empty -m x --no-signoff &&
+ ! git log -1 --format=%B | grep ^Signed-off-by:
+'
+
test_expect_success 'multiple -m' '
>negative &&
--
2.16.1.70.g5ccd54536
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [GSoC][PATCH v2] commit: add a commit.signOff config variable
2018-02-05 10:40 [GSoC][PATCH v2] commit: add a commit.signOff config variable Chen Jingpiao
@ 2018-02-05 19:22 ` Junio C Hamano
2018-02-06 4:37 ` Chen Jingpiao
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2018-02-05 19:22 UTC (permalink / raw)
To: Chen Jingpiao; +Cc: git, sunshine
Chen Jingpiao <chenjingpiao@gmail.com> writes:
> Add the commit.signOff configuration variable to use the -s or --signoff
> option of git commit by default.
This is a rather old topic. Here is one from 2006:
https://public-inbox.org/git/Pine.LNX.4.63.0611281426311.30004@wbgn013.biozentrum.uni-wuerzburg.de/
which was referred to in another discussion in late 2008:
https://public-inbox.org/git/20081227070228.6117@nanako3.lavabit.com/
https://public-inbox.org/git/7vabaijvxl.fsf@gitster.siamese.dyndns.org/
I am not sure if the reasons why the last effort was retracted still
apply to this round (the world certainly has changed in the past 10
years); it would be good to explain why this time it is different
;-).
Assuming that the new configuration variable is a desirable thing to
add, the change to the code looks OK. Documentation updates may
need more thought in the light of past discussions, though.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [GSoC][PATCH v2] commit: add a commit.signOff config variable
2018-02-05 19:22 ` Junio C Hamano
@ 2018-02-06 4:37 ` Chen Jingpiao
0 siblings, 0 replies; 3+ messages in thread
From: Chen Jingpiao @ 2018-02-06 4:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, sunshine
On 02/05 11:22, Junio C Hamano wrote:
> Chen Jingpiao <chenjingpiao@gmail.com> writes:
>
> > Add the commit.signOff configuration variable to use the -s or --signoff
> > option of git commit by default.
>
> This is a rather old topic. Here is one from 2006:
>
> https://public-inbox.org/git/Pine.LNX.4.63.0611281426311.30004@wbgn013.biozentrum.uni-wuerzburg.de/
>
> which was referred to in another discussion in late 2008:
>
> https://public-inbox.org/git/20081227070228.6117@nanako3.lavabit.com/
> https://public-inbox.org/git/7vabaijvxl.fsf@gitster.siamese.dyndns.org/
>
> I am not sure if the reasons why the last effort was retracted still
> apply to this round (the world certainly has changed in the past 10
> years); it would be good to explain why this time it is different
> ;-).
>
> Assuming that the new configuration variable is a desirable thing to
> add, the change to the code looks OK. Documentation updates may
> need more thought in the light of past discussions, though.
>
> Thanks.
I agree with Johannes Schindelin once said "a signoff _has_ to be a
conscious act, or else it will lose its meaning."
I think I shouldn't add this configuration variable. Thank you.
--
Chen Jingpiao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-06 4:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 10:40 [GSoC][PATCH v2] commit: add a commit.signOff config variable Chen Jingpiao
2018-02-05 19:22 ` Junio C Hamano
2018-02-06 4:37 ` Chen Jingpiao
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).