{"thread":{"id":"13356","subject":"[PATCH 0/2] Show committer ident in some cases","startedAt":"2008-05-02T18:22:19Z","lastAt":"2008-05-05T05:23:14Z","messageCount":11,"participants":["Santi Béjar","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"75859","messageId":"1209752541-19111-1-git-send-email-sbejar@gmail.com","threadId":"13356","inReplyTo":null,"subject":"[PATCH 0/2] Show committer ident in some cases","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-02T18:22:19Z","receivedAt":"2008-05-02T18:22:19Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Hi *,\n\n This patch series tries to make more evident the committer ident\nused in a commit to prevent using the wrong one.\n\nThe definition of \"wrong committer\" could be:\n\n1) user.{name,email} or GIT_COMMITTER_{NAME,EMAIL} is not a wrong committer.\n2) automatic without a domain name (user@hostname.(none)) is a wrong committer.\n   (not handled with this patch series)\n3) automatic or partially set ident:\n   a) wrong committer for some users\n   b) right committer for others\n\nThe different strategies are.. Show the committer:\n\n1) always\n2) when user.warn = yes (defaulting to yes)\n3) when it is automatic\n   a) always\n   b) and different from parent\n   c) and different from a list of valid committer idents\n   d) and when user.WarnAutomatic = yes (defaulting to yes)\n\nThe first patch implements 3a\nThe second patch implements 3d\n\nI prefer 3a.\n\nSanti\n\nSanti BÃ©jar (2):\n  commit: Show committer if automatic\n  user.warnautomatic: add config to control if the committer ident is\n    shown\n\n Documentation/config.txt |    4 ++++\n builtin-commit.c         |   40 +++++++++++++++++++++++++++++++++++++---\n cache.h                  |    2 ++\n config.c                 |    9 +++++++++\n environment.c            |    2 ++\n ident.c                  |    3 +++\n t/t7502-commit.sh        |   31 +++++++++++++++++++++++++++++--\n 7 files changed, 86 insertions(+), 5 deletions(-)\n"},{"id":"75860","messageId":"1209752541-19111-2-git-send-email-sbejar@gmail.com","threadId":"13356","inReplyTo":"1209752541-19111-1-git-send-email-sbejar@gmail.com","subject":"[PATCH 1/2] commit: Show committer if automatic","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-02T18:22:20Z","receivedAt":"2008-05-02T18:22:20Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"To remind the committer ident in case it is not what you want\n(taken from the gecos field, want to use different ident in\ndifferent repositories).\n\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n---\n builtin-commit.c  |   40 +++++++++++++++++++++++++++++++++++++---\n cache.h           |    1 +\n config.c          |    4 ++++\n environment.c     |    1 +\n ident.c           |    3 +++\n t/t7502-commit.sh |   13 +++++++++++++\n 6 files changed, 59 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 057749b..b7cc382 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -437,6 +437,29 @@ static void determine_author_info()\n \tauthor_date = date;\n }\n \n+const char *get_parent_ident()\n+{\n+\tunsigned char sha1[20];\n+\tstruct commit *commit;\n+\tconst char *a, *lb, *rb, *eol;\n+\n+\n+\tget_sha1(\"HEAD\", sha1);\n+\tcommit = lookup_commit_reference(sha1);\n+\tif (!commit)\n+\t\treturn NULL;\n+\n+\ta = strstr(commit->buffer, \"\\ncommitter \");\n+\n+\tlb = strstr(a + 11, \" <\");\n+\trb = strstr(a + 11, \"> \");\n+\teol = strchr(a + 11, '\\n');\n+\tif (!lb || !rb || !eol)\n+\t\treturn NULL;\n+\n+\treturn xstrndup(a + 11, rb + 1 - (a + 11));\n+}\n+\n static int prepare_to_commit(const char *index_file, const char *prefix)\n {\n \tstruct stat statbuf;\n@@ -448,6 +471,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \tconst char *hook_arg2 = NULL;\n \tconst char *author_ident;\n \tconst char *committer_ident;\n+\tint showed_ident = 0;\n \n \tif (!no_verify && run_hook(index_file, \"pre-commit\", NULL))\n \t\treturn 0;\n@@ -528,6 +552,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \tstrbuf_release(&sb);\n \n \tdetermine_author_info();\n+\tgit_committer_info(0);\n \n \tif (use_editor) {\n \t\tif (in_merge)\n@@ -558,11 +583,20 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \t\t\t\t\t getenv(\"GIT_COMMITTER_EMAIL\")));\n \t\tif (strcmp(author_ident, committer_ident))\n \t\t\tfprintf(fp,\n-\t\t\t\t\"#\\n\"\n-\t\t\t\t\"# Author:    %s\\n\"\n-\t\t\t\t\"#\\n\",\n+\t\t\t\t\"%s\"\n+\t\t\t\t\"# Author:    %s\\n\",\n+\t\t\t\tshowed_ident++ ? \"\" : \"#\\n\",\n \t\t\t\tfmt_name(author_name, author_email));\n \n+\t\tif (!user_explicit)\n+\t\t\tfprintf(fp,\n+\t\t\t\t\"%s# Committer: %s\\n\",\n+\t\t\t\tshowed_ident++ ? \"\" : \"#\\n\",\n+\t\t\t\tcommitter_ident);\n+\n+\t\tif (showed_ident)\n+\t\t\tfprintf(fp, \"#\\n\");\n+\n \t\tsaved_color_setting = wt_status_use_color;\n \t\twt_status_use_color = 0;\n \t\tcommitable = run_status(fp, index_file, prefix, 1);\ndiff --git a/cache.h b/cache.h\nindex 5a28ddd..e8b26cf 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -718,6 +718,7 @@ extern int config_error_nonbool(const char *);\n #define MAX_GITNAME (1000)\n extern char git_default_email[MAX_GITNAME];\n extern char git_default_name[MAX_GITNAME];\n+extern int user_explicit;\n \n extern const char *git_commit_encoding;\n extern const char *git_log_output_encoding;\ndiff --git a/config.c b/config.c\nindex b0ada51..e49804a 100644\n--- a/config.c\n+++ b/config.c\n@@ -443,6 +443,8 @@ int git_default_config(const char *var, const char *value)\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n \t\tstrlcpy(git_default_name, value, sizeof(git_default_name));\n+\t\tif (git_default_email[0])\n+\t\t\tuser_explicit = 1;\n \t\treturn 0;\n \t}\n \n@@ -450,6 +452,8 @@ int git_default_config(const char *var, const char *value)\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n \t\tstrlcpy(git_default_email, value, sizeof(git_default_email));\n+\t\tif (git_default_name[0])\n+\t\t\tuser_explicit = 1;\n \t\treturn 0;\n \t}\n \ndiff --git a/environment.c b/environment.c\nindex 6739a3f..b941971 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -11,6 +11,7 @@\n \n char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n+int user_explicit = 0;\n int trust_executable_bit = 1;\n int quote_path_fully = 1;\n int has_symlinks = 1;\ndiff --git a/ident.c b/ident.c\nindex ed44a53..67ccbf3 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -250,6 +250,9 @@ const char *git_author_info(int flag)\n \n const char *git_committer_info(int flag)\n {\n+\tif (getenv(\"GIT_COMMITTER_NAME\") &&\n+\t    getenv(\"GIT_COMMITTER_EMAIL\"))\n+\t\tuser_explicit = 1;\n \treturn fmt_ident(getenv(\"GIT_COMMITTER_NAME\"),\n \t\t\t getenv(\"GIT_COMMITTER_EMAIL\"),\n \t\t\t getenv(\"GIT_COMMITTER_DATE\"),\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 11de910..8f65c39 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -165,6 +165,19 @@ test_expect_success 'author different from committer' '\n \ttest_cmp expect actual\n '\n \n+echo \"# Committer:\" >> expect\n+unset GIT_COMMITTER_EMAIL\n+unset GIT_COMMITTER_NAME\n+\n+test_expect_success 'committer is automatic' '\n+\n+\techo >>negative &&\n+\tgit commit -e -m \"sample\"\n+\thead -n 7 .git/COMMIT_EDITMSG |\t\\\n+\tsed \"s/^# Committer: .*/# Committer:/\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n pwd=`pwd`\n cat >> .git/FAKE_EDITOR << EOF\n #! /bin/sh\n-- \n1.5.5.1.223.g2532\n"},{"id":"75861","messageId":"1209752541-19111-3-git-send-email-sbejar@gmail.com","threadId":"13356","inReplyTo":"1209752541-19111-1-git-send-email-sbejar@gmail.com","subject":"[PATCH 2/2] user.warnautomatic: add config to control if the committer ident is shown","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-02T18:22:21Z","receivedAt":"2008-05-02T18:22:21Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n---\n Documentation/config.txt |    4 ++++\n builtin-commit.c         |    2 +-\n cache.h                  |    1 +\n config.c                 |    5 +++++\n environment.c            |    1 +\n t/t7502-commit.sh        |   22 ++++++++++++++++++----\n 6 files changed, 30 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 824e416..9c770a6 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -994,6 +994,10 @@ user.signingkey::\n \tunchanged to gpg's --local-user parameter, so you may specify a key\n \tusing any method that gpg supports.\n \n+user.warnautomatic::\n+\tA boolean to show the committer ident while committing in the editor\n+\tif it is set automatically. Defaults to true.\n+\n whatchanged.difftree::\n \tThe default linkgit:git-diff-tree[1] arguments to be used\n \tfor linkgit:git-whatchanged[1].\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex b7cc382..7ab8b40 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -588,7 +588,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \t\t\t\tshowed_ident++ ? \"\" : \"#\\n\",\n \t\t\t\tfmt_name(author_name, author_email));\n \n-\t\tif (!user_explicit)\n+\t\tif (!user_explicit && user_warnautomatic)\n \t\t\tfprintf(fp,\n \t\t\t\t\"%s# Committer: %s\\n\",\n \t\t\t\tshowed_ident++ ? \"\" : \"#\\n\",\ndiff --git a/cache.h b/cache.h\nindex e8b26cf..5d0dd23 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -719,6 +719,7 @@ extern int config_error_nonbool(const char *);\n extern char git_default_email[MAX_GITNAME];\n extern char git_default_name[MAX_GITNAME];\n extern int user_explicit;\n+extern int user_warnautomatic;\n \n extern const char *git_commit_encoding;\n extern const char *git_log_output_encoding;\ndiff --git a/config.c b/config.c\nindex e49804a..1588053 100644\n--- a/config.c\n+++ b/config.c\n@@ -457,6 +457,11 @@ int git_default_config(const char *var, const char *value)\n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"user.warnautomatic\")) {\n+\t\tuser_warnautomatic = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \tif (!strcmp(var, \"i18n.commitencoding\"))\n \t\treturn git_config_string(&git_commit_encoding, var, value);\n \ndiff --git a/environment.c b/environment.c\nindex b941971..6b6ede6 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -12,6 +12,7 @@\n char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int user_explicit = 0;\n+int user_warnautomatic = 1;\n int trust_executable_bit = 1;\n int quote_path_fully = 1;\n int has_symlinks = 1;\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 8f65c39..a63f9c4 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -155,25 +155,39 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' '\n '\n \n echo \"#\n-# Author:    $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\" >> expect\n+# Author:    $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n+#\" >> expect\n \n test_expect_success 'author different from committer' '\n \n \techo >>negative &&\n \tgit commit -e -m \"sample\"\n-\thead -n 6 .git/COMMIT_EDITMSG >actual &&\n+\thead -n 7 .git/COMMIT_EDITMSG >actual &&\n \ttest_cmp expect actual\n '\n \n-echo \"# Committer:\" >> expect\n unset GIT_COMMITTER_EMAIL\n unset GIT_COMMITTER_NAME\n \n+test_expect_success 'committer is automatic but user.warnautomatic=no' '\n+\n+\tgit config user.warnautomatic no\n+\techo >>negative &&\n+\tgit commit -e -m \"sample\"\n+\thead -n 7 .git/COMMIT_EDITMSG >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+sed -i '$d' expect\n+echo \"# Committer:\n+#\" >> expect\n+\n test_expect_success 'committer is automatic' '\n \n+\tgit config --unset user.warnautomatic\n \techo >>negative &&\n \tgit commit -e -m \"sample\"\n-\thead -n 7 .git/COMMIT_EDITMSG |\t\\\n+\thead -n 8 .git/COMMIT_EDITMSG |\t\\\n \tsed \"s/^# Committer: .*/# Committer:/\" >actual &&\n \ttest_cmp expect actual\n '\n-- \n1.5.5.1.223.g2532\n"},{"id":"75878","messageId":"7vwsmcwfcn.fsf@gitster.siamese.dyndns.org","threadId":"13356","inReplyTo":"1209752541-19111-1-git-send-email-sbejar@gmail.com","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T21:44:40Z","receivedAt":"2008-05-02T21:44:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n> The definition of \"wrong committer\" could be:\n>\n> 1) user.{name,email} or GIT_COMMITTER_{NAME,EMAIL} is not a wrong committer.\n> 2) automatic without a domain name (user@hostname.(none)) is a wrong committer.\n>    (not handled with this patch series)\n> 3) automatic or partially set ident:\n>    a) wrong committer for some users\n>    b) right committer for others\n\nDefine \"partially set\".\n\n> Santi BÃ©jar (2):\n\n???\n"},{"id":"75881","messageId":"8aa486160805021507s44d7946ejc48ac8a4af08e8cc@mail.gmail.com","threadId":"13356","inReplyTo":"7vwsmcwfcn.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-02T22:07:44Z","receivedAt":"2008-05-02T22:07:44Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, May 2, 2008 at 11:44 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Santi Béjar <sbejar@gmail.com> writes:\n>\n>  > The definition of \"wrong committer\" could be:\n>  >\n>  > 1) user.{name,email} or GIT_COMMITTER_{NAME,EMAIL} is not a wrong committer.\n>  > 2) automatic without a domain name (user@hostname.(none)) is a wrong committer.\n>  >    (not handled with this patch series)\n>  > 3) automatic or partially set ident:\n>  >    a) wrong committer for some users\n>  >    b) right committer for others\n>\n>  Define \"partially set\".\n\none of user.{name,email} is not set.\n\n>\n>  > Santi BÃ(c)jar (2):\n>\n>  ???\n\nthe MIME stuff was not written for the cover letter.\n\nSanti\n\n>\n"},{"id":"75884","messageId":"7vbq3owd4o.fsf@gitster.siamese.dyndns.org","threadId":"13356","inReplyTo":"8aa486160805021507s44d7946ejc48ac8a4af08e8cc@mail.gmail.com","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T22:32:39Z","receivedAt":"2008-05-02T22:32:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Santi Béjar\" <sbejar@gmail.com> writes:\n\n> On Fri, May 2, 2008 at 11:44 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Santi Béjar <sbejar@gmail.com> writes:\n>>\n>>  > The definition of \"wrong committer\" could be:\n>>  >\n>>  > 1) user.{name,email} or GIT_COMMITTER_{NAME,EMAIL} is not a wrong committer.\n>>  > 2) automatic without a domain name (user@hostname.(none)) is a wrong committer.\n>>  >    (not handled with this patch series)\n>>  > 3) automatic or partially set ident:\n>>  >    a) wrong committer for some users\n>>  >    b) right committer for others\n>>\n>>  Define \"partially set\".\n>\n> one of user.{name,email} is not set.\n\nHmmm.  Then perhaps the list can be simplified as follows?\n\n * Both name and email are explicitly given (i.e. user.* or\n   GIT_COMMITTER_* specifies them) --- no complaints.\n\n * For email, ending with \".(none)\" and \"@\" followed by something without\n   a dot is wrong but everything else are Ok.\n\n * Everything else falls into (3)\n\nThere is no \"partially\" then.\n\nBy the way, wasn't it you who wanted to refuse use of user.name _and_\nuser.email that come from ~/.gitconfig, so that you can be sure you use\ndifferent pseudonym for each project?\n"},{"id":"75909","messageId":"8aa486160805030318oa9d7f85y4b83ec52905338e5@mail.gmail.com","threadId":"13356","inReplyTo":"7vbq3owd4o.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-03T10:18:59Z","receivedAt":"2008-05-03T10:18:59Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":">\n>  By the way, wasn't it you who wanted to refuse use of user.name _and_\n>  user.email that come from ~/.gitconfig, so that you can be sure you use\n>  different pseudonym for each project?\n>\n\nYes, that's me. But what I wanted was to refuse the use of the\nautomatic setting.\n\nSanti\n"},{"id":"75955","messageId":"7vmyn7tezi.fsf@gitster.siamese.dyndns.org","threadId":"13356","inReplyTo":"1209752541-19111-2-git-send-email-sbejar@gmail.com","subject":"Re: [PATCH 1/2] commit: Show committer if automatic","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-03T18:33:05Z","receivedAt":"2008-05-03T18:33:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n> To remind the committer ident in case it is not what you want\n> (taken from the gecos field, want to use different ident in\n> different repositories).\n\nThat's not the only thing this patch does.\n\n> Signed-off-by: Santi Béjar <sbejar@gmail.com>\n> ---\n>  builtin-commit.c  |   40 +++++++++++++++++++++++++++++++++++++---\n>  cache.h           |    1 +\n>  config.c          |    4 ++++\n>  environment.c     |    1 +\n>  ident.c           |    3 +++\n>  t/t7502-commit.sh |   13 +++++++++++++\n>  6 files changed, 59 insertions(+), 3 deletions(-)\n>\n> diff --git a/builtin-commit.c b/builtin-commit.c\n> index 057749b..b7cc382 100644\n> --- a/builtin-commit.c\n> +++ b/builtin-commit.c\n> @@ -437,6 +437,29 @@ static void determine_author_info()\n>  \tauthor_date = date;\n>  }\n>  \n> +const char *get_parent_ident()\n> +{\n> +\tunsigned char sha1[20];\n> +\tstruct commit *commit;\n> +\tconst char *a, *lb, *rb, *eol;\n> +\n> +\n> +\tget_sha1(\"HEAD\", sha1);\n> +\tcommit = lookup_commit_reference(sha1);\n> +\tif (!commit)\n> +\t\treturn NULL;\n> +\n> +\ta = strstr(commit->buffer, \"\\ncommitter \");\n> +\n> +\tlb = strstr(a + 11, \" <\");\n> +\trb = strstr(a + 11, \"> \");\n> +\teol = strchr(a + 11, '\\n');\n> +\tif (!lb || !rb || !eol)\n> +\t\treturn NULL;\n> +\n> +\treturn xstrndup(a + 11, rb + 1 - (a + 11));\n> +}\n> +\n\nDrop this hunk; nobody uses it after applying this patch, and \"the same\ncommitter as the HEAD commit\" is not a good heuristic.\n\n>  static int prepare_to_commit(const char *index_file, const char *prefix)\n>  {\n>  \tstruct stat statbuf;\n> @@ -448,6 +471,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  \tconst char *hook_arg2 = NULL;\n>  \tconst char *author_ident;\n>  \tconst char *committer_ident;\n> +\tint showed_ident = 0;\n>  \n>  \tif (!no_verify && run_hook(index_file, \"pre-commit\", NULL))\n>  \t\treturn 0;\n> @@ -528,6 +552,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  \tstrbuf_release(&sb);\n>  \n>  \tdetermine_author_info();\n> +\tgit_committer_info(0);\n\nThis call needs a comment to justify it, as it feels wrong to call a\nfunction that usually is used for its return string and discard the return\nvalue.\n\n> @@ -558,11 +583,20 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  \t\t\t\t\t getenv(\"GIT_COMMITTER_EMAIL\")));\n>  \t\tif (strcmp(author_ident, committer_ident))\n>  \t\t\tfprintf(fp,\n> -\t\t\t\t\"#\\n\"\n> -\t\t\t\t\"# Author:    %s\\n\"\n> -\t\t\t\t\"#\\n\",\n> +\t\t\t\t\"%s\"\n> +\t\t\t\t\"# Author:    %s\\n\",\n> +\t\t\t\tshowed_ident++ ? \"\" : \"#\\n\",\n>  \t\t\t\tfmt_name(author_name, author_email));\n\nThis part should have been [0/2] as it has been agreed it is a good idea.\n"},{"id":"75959","messageId":"8aa486160805031328o7dfae18fnac1bbea7420e0193@mail.gmail.com","threadId":"13356","inReplyTo":"7vmyn7tezi.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/2] commit: Show committer if automatic","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-03T20:28:52Z","receivedAt":"2008-05-03T20:28:52Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Sat, May 3, 2008 at 8:33 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Santi Béjar <sbejar@gmail.com> writes:\n\n[...]\n\n>\n>  >  static int prepare_to_commit(const char *index_file, const char *prefix)\n>  >  {\n>  >       struct stat statbuf;\n>  > @@ -448,6 +471,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  >       const char *hook_arg2 = NULL;\n>  >       const char *author_ident;\n>  >       const char *committer_ident;\n>  > +     int showed_ident = 0;\n>  >\n>  >       if (!no_verify && run_hook(index_file, \"pre-commit\", NULL))\n>  >               return 0;\n>  > @@ -528,6 +552,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  >       strbuf_release(&sb);\n>  >\n>  >       determine_author_info();\n>  > +     git_committer_info(0);\n>\n>  This call needs a comment to justify it, as it feels wrong to call a\n>  function that usually is used for its return string and discard the return\n>  value.\n\nIn the code or in the commit message.\n\n/* To know if the committer ident is automatic */\n\nI did it this way to have the knowledge about the automatic setting in\ngit_committer_info.\n\n>\n>\n>  > @@ -558,11 +583,20 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n>  >                                        getenv(\"GIT_COMMITTER_EMAIL\")));\n>  >               if (strcmp(author_ident, committer_ident))\n>  >                       fprintf(fp,\n>  > -                             \"#\\n\"\n>  > -                             \"# Author:    %s\\n\"\n>  > -                             \"#\\n\",\n>  > +                             \"%s\"\n>  > +                             \"# Author:    %s\\n\",\n>  > +                             showed_ident++ ? \"\" : \"#\\n\",\n>  >                               fmt_name(author_name, author_email));\n>\n>  This part should have been [0/2] as it has been agreed it is a good idea.\n\nSorry, I should have said to this series was on top of:\n\n[PATCHv2 2/3] commit: Show author if different from committer\n\nI'll send a series with this include and the corrections.\n\nSanti\n"},{"id":"76062","messageId":"20080505033044.GB15498@sigill.intra.peff.net","threadId":"13356","inReplyTo":"1209752541-19111-1-git-send-email-sbejar@gmail.com","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-05T03:30:44Z","receivedAt":"2008-05-05T03:30:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 08:22:19PM +0200, Santi Béjar wrote:\n\n> The different strategies are.. Show the committer:\n> \n> 1) always\n> 2) when user.warn = yes (defaulting to yes)\n> 3) when it is automatic\n>    a) always\n>    b) and different from parent\n>    c) and different from a list of valid committer idents\n>    d) and when user.WarnAutomatic = yes (defaulting to yes)\n> \n> The first patch implements 3a\n> The second patch implements 3d\n> \n> I prefer 3a.\n\nI haven't kept up to date very well with this patch, but let me add a\n(possibly belated) addendum to my earlier comments: I like 3a, and I\nthink it addresses the issues I brought up in earlier revisions.\n\n-Peff\n"},{"id":"76075","messageId":"7vhcddnx31.fsf@gitster.siamese.dyndns.org","threadId":"13356","inReplyTo":"20080505033044.GB15498@sigill.intra.peff.net","subject":"Re: [PATCH 0/2] Show committer ident in some cases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-05T05:23:14Z","receivedAt":"2008-05-05T05:23:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, May 02, 2008 at 08:22:19PM +0200, Santi Béjar wrote:\n>\n>> The different strategies are.. Show the committer:\n>> \n>> 1) always\n>> 2) when user.warn = yes (defaulting to yes)\n>> 3) when it is automatic\n>>    a) always\n>>    b) and different from parent\n>>    c) and different from a list of valid committer idents\n>>    d) and when user.WarnAutomatic = yes (defaulting to yes)\n>> \n>> The first patch implements 3a\n>> The second patch implements 3d\n>> \n>> I prefer 3a.\n>\n> I haven't kept up to date very well with this patch, but let me add a\n> (possibly belated) addendum to my earlier comments: I like 3a, and I\n> think it addresses the issues I brought up in earlier revisions.\n\nI tend to agree.\n\nI usually _really_ hate any patch that adds noise that punishes people\nwhose system is configured and maintained well.\n\nThe 3a approach punishes people on a well maintained system where you\nwould get a good value out of GECOS and gethostname(2) by forcing them to\nduplicate the information in their .git/config (or $HOME/.gitconfig).  So\nI should be hating the idea, but I think alternatives are much worse than\nthat, and it is the least problematic.\n"}]}