{"thread":{"id":"22095","subject":"edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","startedAt":"2010-01-03T23:32:57Z","lastAt":"2010-01-17T16:18:30Z","messageCount":54,"participants":["Adam Megacz","Sverre Rabbelier","David Aguilar","Nanako Shiraishi","Junio C Hamano","Santi Béjar","Jeff King","Johannes Schindelin","Wincent Colaiuta","Chris Johnsen","Thomas Rast","Felipe Contreras","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"130794","messageId":"xuu2fx6m4vdi.fsf@nowhere.com","threadId":"22095","inReplyTo":null,"subject":"edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-03T23:32:57Z","receivedAt":"2010-01-03T23:32:57Z","isPatch":false,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nHi, folks.\n\n>From the output of 'git show', it appears that a commit has a few fields\nof metadata associated with it in addition to the comment.  These fields\nseem to include Author, AuthorDate, Committer, and CommitDate.\n\n  1. Are there other fields aside from these four?\n\n  2. When I invoke 'git commit' without the '-m' argument I'm dropped\n     into the cozy $EDITOR of my choice and given the opportunity to\n     edit the commit message.  Is there any way to include the metadata\n     fields in this editing session?  That way I could both sanity-check\n     them as I perform the commit (important) and modify them if they're\n     wrong (less important).\n\n     I've been having problems lately with running git on machines where\n     I forgot to set up my .gitconfig; I wind up with patches that have\n     committers like root@mymachine and so forth.  Being automatically\n     shown the committer/author when I make the commit would help me\n     avoid these situations.\n\nThanks,\n\n  - a\n"},{"id":"130795","messageId":"fabb9a1e1001041232h4e5827d1pb5c648b33ecfb5ce@mail.gmail.com","threadId":"22095","inReplyTo":"xuu2fx6m4vdi.fsf@nowhere.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-01-04T20:32:19Z","receivedAt":"2010-01-04T20:32:19Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Jan 3, 2010 at 18:32, Adam Megacz <adam@megacz.com> wrote:\n>     I've been having problems lately with running git on machines where\n>     I forgot to set up my .gitconfig; I wind up with patches that have\n>     committers like root@mymachine and so forth.  Being automatically\n>     shown the committer/author when I make the commit would help me\n>     avoid these situations.\n\nAt the very least it should be easy to include these fields as\ncomments in the message template. But of course you would still be\nbitten if you used \"git commit -m\" :(.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"130796","messageId":"xuu2zl4tfuij.fsf@nowhere.com","threadId":"22095","inReplyTo":"fabb9a1e1001041232h4e5827d1pb5c648b33ecfb5ce@mail.gmail.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-04T21:08:20Z","receivedAt":"2010-01-04T21:08:20Z","isPatch":false,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nSverre Rabbelier <srabbelier@gmail.com> writes:\n> On Sun, Jan 3, 2010 at 18:32, Adam Megacz <adam@megacz.com> wrote:\n>>     I've been having problems lately with running git on machines where\n>>     I forgot to set up my .gitconfig; I wind up with patches that have\n>>     committers like root@mymachine and so forth.  Being automatically\n>>     shown the committer/author when I make the commit would help me\n>>     avoid these situations.\n>\n> At the very least it should be easy to include these fields as\n> comments in the message template.\n\nThat would be great.\n\n> But of course you would still be bitten if you used \"git commit -m\"\n> :(.\n\nPerhaps a preference (off by default) demanding that they be set\nexplicitly when \"git commit -m\" is used?\n\nSome people care more than others about the metadata; this is for the\nfolks to whom it matters a lot.\n\n  - a\n"},{"id":"130800","messageId":"fabb9a1e1001041452q299f1f28hff041eb06fd24b1f@mail.gmail.com","threadId":"22095","inReplyTo":"xuu2zl4tfuij.fsf@nowhere.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-01-04T22:52:42Z","receivedAt":"2010-01-04T22:52:42Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Mon, Jan 4, 2010 at 16:08, Adam Megacz <adam@megacz.com> wrote:\n> Perhaps a preference (off by default) demanding that they be set\n> explicitly when \"git commit -m\" is used?\n\nHeh, what use would that be? On a different/new box you would have\nneither that setting nor the email set, so that doens't solve the\nproblem methinks :P.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"130860","messageId":"20100105202159.GA2657@gmail.com","threadId":"22095","inReplyTo":"fabb9a1e1001041452q299f1f28hff041eb06fd24b1f@mail.gmail.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2010-01-05T20:22:00Z","receivedAt":"2010-01-05T20:22:00Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Jan 04, 2010 at 05:52:42PM -0500, Sverre Rabbelier wrote:\n> Heya,\n> \n> On Mon, Jan 4, 2010 at 16:08, Adam Megacz <adam@megacz.com> wrote:\n> > Perhaps a preference (off by default) demanding that they be set\n> > explicitly when \"git commit -m\" is used?\n> \n> Heh, what use would that be? On a different/new box you would have\n> neither that setting nor the email set, so that doens't solve the\n> problem methinks :P.\n> \n> -- \n> Cheers,\n> \n> Sverre Rabbelier\n\nWorkaround:\n\nIf you use \"git commit -s\" it includes a Signed-off-by line\nwhich includes your name and email.\n\nSeeing \"Signed-off-by: root <root@localhost>\" would give you a\nhint that you should abort the commit, set the vars, and\ntry again.\n\n\n-- \n\t\tDavid\n"},{"id":"130866","messageId":"20100106073806.6117@nanako3.lavabit.com","threadId":"22095","inReplyTo":"xuu2zl4tfuij.fsf@nowhere.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2010-01-05T22:38:06Z","receivedAt":"2010-01-05T22:38:06Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Adam Megacz <adam@megacz.com>\n\n> Perhaps a preference (off by default) demanding that they be set\n> explicitly when \"git commit -m\" is used?\n\nSverre pointed out why this won't work.\n\n> Some people care more than others about the metadata; this is for the\n> folks to whom it matters a lot.\n\nSo the only workable solution is to check your commits with \"git show -s\" until you become confident that you configured your new box correctly. Some people unfortunately don't care enough to do so, but it is for the people to whom it matters.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"130924","messageId":"7v4omz17xz.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100106073806.6117@nanako3.lavabit.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-06T17:04:08Z","receivedAt":"2010-01-06T17:04:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Adam Megacz <adam@megacz.com>\n>\n>> Perhaps a preference (off by default) demanding that they be set\n>> explicitly when \"git commit -m\" is used?\n>\n> Sverre pointed out why this won't work.\n>\n>> Some people care more than others about the metadata; this is for the\n>> folks to whom it matters a lot.\n>\n> So the only workable solution is to check your commits with \"git show\n> -s\" until you become confident that you configured your new box\n> correctly. Some people unfortunately don't care enough to do so, but it\n> is for the people to whom it matters.\n\nTraditionally, we've only had a minimal sanity check (e.g. to barf when\nthe name is empty, or something silly like that) and tried to come up with\na reasonable name/email given the available system information.\n\nThe approach may have been Ok 10 years ago, back when `whoami`@`hostname`,\nat least on systems that were competently maintained, gave a reasonable\nmail address for most people, but I don't think it is adequate anymore to\nmajority of people, especially the ones who work on Open Source projects\nas individuals, whose desired public identities are often tied to their\nemail account at their ISPs or mailbox providers (like gmail), and there\nis no way for us to guess what it is from `whoami` nor `hostname` [*1*].\n\nSo I don't think anybody minds if we refuse to work if we are going to end\nup using a name that we didn't get from an explicit end user configuration\n(i.e. GIT_*_EMAIL and GIT_*_NAME environment and user.* configuration\nvariables).\n\n\n[Footnote]\n\n*1* Inside corporate environments, `whoami`@`hostname -f` might still be a\nreasonable and usable default, though.\n"},{"id":"131071","messageId":"xuu28wc9xd42.fsf@nowhere.com","threadId":"22095","inReplyTo":"7v4omz17xz.fsf@alter.siamese.dyndns.org","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-08T07:35:57Z","receivedAt":"2010-01-08T07:35:57Z","isPatch":false,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> writes:\n> Nanako Shiraishi <nanako3@lavabit.com> writes:\n>> Quoting Adam Megacz <adam@megacz.com>\n>>> Perhaps a preference (off by default) demanding that they be set\n>>> explicitly when \"git commit -m\" is used?\n\n>> Sverre pointed out why this won't work.\n\nI agree; making it a preference will not help.\n\nI propose instead that \"git commit -e\" cause the metadata headers to be\nprovided to $EDITOR.  People who care about the metadata can simply get\nin the habit of always passing that option when invoking \"git commit\".\n\n> The approach may have been Ok 10 years ago, back when `whoami`@`hostname`,\n> at least on systems that were competently maintained, gave a reasonable\n> mail address for most people, but I don't think it is adequate anymore to\n> majority of people,\n\nI agree.\n\n> So I don't think anybody minds if we refuse to work if we are going to end\n> up using a name that we didn't get from an explicit end user configuration\n> (i.e. GIT_*_EMAIL and GIT_*_NAME environment and user.* configuration\n> variables).\n\nI support that as well, although I'd still like to be shown the data.  I\nwear a few different hats (each with its own email address), and I don't\nthink I want to pick one of them as the default.\n\nThanks,\n\n  - a\n"},{"id":"131100","messageId":"7vskagh9fg.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"xuu28wc9xd42.fsf@nowhere.com","subject":"Re: edit Author/Date metadata as part of 'git commit' $EDITOR invocation?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-08T16:02:11Z","receivedAt":"2010-01-08T16:02:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Megacz <adam@megacz.com> writes:\n\n> I propose instead that \"git commit -e\" cause the metadata headers to be\n> provided to $EDITOR.  People who care about the metadata can simply get\n> in the habit of always passing that option when invoking \"git commit\".\n\nThat is already done by bb1ae3f (commit: Show committer if automatic,\n2008-05-04), so there is no need to propose anything.\n\nI see a bit of room for tightening logic in that ancient commit, though.\n"},{"id":"131101","messageId":"7vfx6geg80.fsf_-_@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"7vskagh9fg.fsf@alter.siamese.dyndns.org","subject":"[PATCH 1/3] ident.c: remove unused variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-08T16:03:43Z","receivedAt":"2010-01-08T16:03:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"d5cc2de (ident.c: Trim hint printed when gecos is empty., 2006-11-28)\nreworded the message used as printf() format and dropped \"%s\" from it;\nthese two variables that hold the names of GIT_{AUTHOR,COMMITTER}_NAME\nenvironment variables haven't been used since then.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * This is an independent clean-up\n\n ident.c |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex 26409b2..e6c1798 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -168,8 +168,6 @@ static int copy(char *buf, size_t size, int offset, const char *src)\n \treturn offset;\n }\n \n-static const char au_env[] = \"GIT_AUTHOR_NAME\";\n-static const char co_env[] = \"GIT_COMMITTER_NAME\";\n static const char *env_hint =\n \"\\n\"\n \"*** Please tell me who you are.\\n\"\n@@ -204,7 +202,7 @@ const char *fmt_ident(const char *name, const char *email,\n \n \t\tif ((warn_on_no_name || error_on_no_name) &&\n \t\t    name == git_default_name && env_hint) {\n-\t\t\tfprintf(stderr, env_hint, au_env, co_env);\n+\t\t\tfprintf(stderr, env_hint);\n \t\t\tenv_hint = NULL; /* warn only once */\n \t\t}\n \t\tif (error_on_no_name)\n-- \n1.6.6.209.g52296.dirty\n"},{"id":"131102","messageId":"7vbph4eg63.fsf_-_@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"7vskagh9fg.fsf@alter.siamese.dyndns.org","subject":"[PATCH 2/3] ident.c: check explicit identity for name and email separately","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-08T16:04:52Z","receivedAt":"2010-01-08T16:04:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"bb1ae3f (commit: Show committer if automatic, 2008-05-04) added a logic to\ncheck both name and email were given explicitly by the end user, but it\nassumed that fmt_ident() is never called before git_default_user_config()\nis called, which was fragile.  The former calls setup_ident() and fills\nthe \"default\" name and email, so the check in the config parser would have\nmistakenly said both are given even if only user.name was provided.\n\nMake the logic more robust by keeping track of name and email separately.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-commit.c |    2 +-\n cache.h          |    3 +++\n config.c         |    6 ++----\n ident.c          |    7 ++++---\n 4 files changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 073fe90..f4974b5 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -624,7 +624,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\t\tauthor_ident);\n \t\tfree(author_ident);\n \n-\t\tif (!user_ident_explicitly_given)\n+\t\tif (user_ident_explicitly_given != IDENT_ALL_GIVEN)\n \t\t\tfprintf(fp,\n \t\t\t\t\"%s\"\n \t\t\t\t\"# Committer: %s\\n\",\ndiff --git a/cache.h b/cache.h\nindex bf468e5..16c8e8d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -925,6 +925,9 @@ extern const char *config_exclusive_filename;\n #define MAX_GITNAME (1000)\n extern char git_default_email[MAX_GITNAME];\n extern char git_default_name[MAX_GITNAME];\n+#define IDENT_NAME_GIVEN 01\n+#define IDENT_MAIL_GIVEN 02\n+#define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)\n extern int user_ident_explicitly_given;\n \n extern const char *git_commit_encoding;\ndiff --git a/config.c b/config.c\nindex 37385ce..fa1a0c0 100644\n--- a/config.c\n+++ b/config.c\n@@ -528,8 +528,7 @@ static int git_default_user_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_ident_explicitly_given = 1;\n+\t\tuser_ident_explicitly_given |= IDENT_NAME_GIVEN;\n \t\treturn 0;\n \t}\n \n@@ -537,8 +536,7 @@ static int git_default_user_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_ident_explicitly_given = 1;\n+\t\tuser_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n \t\treturn 0;\n \t}\n \ndiff --git a/ident.c b/ident.c\nindex e6c1798..e67c5ad 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -249,9 +249,10 @@ 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_ident_explicitly_given = 1;\n+\tif (getenv(\"GIT_COMMITTER_NAME\"))\n+\t\tuser_ident_explicitly_given |= IDENT_NAME_GIVEN;\n+\tif (getenv(\"GIT_COMMITTER_EMAIL\"))\n+\t\tuser_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n \treturn fmt_ident(getenv(\"GIT_COMMITTER_NAME\"),\n \t\t\t getenv(\"GIT_COMMITTER_EMAIL\"),\n \t\t\t getenv(\"GIT_COMMITTER_DATE\"),\n-- \n1.6.6.209.g52296.dirty\n"},{"id":"131103","messageId":"7v637cefzh.fsf_-_@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"7vskagh9fg.fsf@alter.siamese.dyndns.org","subject":"[RFC PATCH 3/3] ident.c: treat $EMAIL as giving user.email identity explicitly","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-08T16:08:50Z","receivedAt":"2010-01-08T16:08:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The environment variable EMAIL has been honored since 28a94f8 (Fall back\nto $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL,\n2007-04-28) as the end-user's wish to use the address as the identity.\nWhen we use it, we should say we are explicitly given email by the user.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This is an RFC as some people would feel strongly about _not_ using\n   $EMAIL as their commit identity and would rather override it explicitly\n   with user.email; if they weren't told about git using their $EMAIL,\n   they will complain.\n\n ident.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex e67c5ad..d4f6145 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -85,10 +85,11 @@ static void setup_ident(void)\n \tif (!git_default_email[0]) {\n \t\tconst char *email = getenv(\"EMAIL\");\n \n-\t\tif (email && email[0])\n+\t\tif (email && email[0]) {\n \t\t\tstrlcpy(git_default_email, email,\n \t\t\t\tsizeof(git_default_email));\n-\t\telse {\n+\t\t\tuser_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n+\t\t} else {\n \t\t\tif (!pw)\n \t\t\t\tpw = getpwuid(getuid());\n \t\t\tif (!pw)\n-- \n1.6.6.209.g52296.dirty\n"},{"id":"131136","messageId":"adf1fd3d1001081433g4168ae52w901a1ceceebad043@mail.gmail.com","threadId":"22095","inReplyTo":"7vbph4eg63.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] ident.c: check explicit identity for name and email separately","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-01-08T22:33:16Z","receivedAt":"2010-01-08T22:33:16Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Jan 8, 2010 at 5:04 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> bb1ae3f (commit: Show committer if automatic, 2008-05-04) added a logic to\n> check both name and email were given explicitly by the end user, but it\n> assumed that fmt_ident() is never called before git_default_user_config()\n> is called, which was fragile.  The former calls setup_ident() and fills\n> the \"default\" name and email, so the check in the config parser would have\n> mistakenly said both are given even if only user.name was provided.\n>\n> Make the logic more robust by keeping track of name and email separately.\n>\n\nIt's a good improvement, thanks.\n\nAcked-by: Santi Béjar <santi@agolina.net>\n\nSanti\n"},{"id":"131253","messageId":"xuu2fx6d9rzb.fsf_-_@nowhere.com","threadId":"22095","inReplyTo":"7vskagh9fg.fsf@alter.siamese.dyndns.org","subject":"[PATCH] Display author and committer after \"git commit\"","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-11T04:37:44Z","receivedAt":"2010-01-11T04:37:44Z","isPatch":true,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nDisplay author (name, email, date) and committer (name, email, date)\nafter creating a new commit to ensure that the user is alerted in the\nevent that they are set in an undesirable manner.\n\nThis patch seeks to accomplish the following goal: all data included\nin the commit which are sha1-protected (and therefore immutable) are\neither taken from the working tree or else displayed to the user for\nsanity checking purposes.  Since the author/committer information is\nimmutable and not taken from the working tree, achieving the goal\nabove requires printing out the author/committer.  The short window of\ntime after committing a patch and before propagating it is the last\nopportunity to modify the data (by deleting and recreating the commit).\n\nThis patch is not necessarily meant for inclusion verbatim; it's more\nof a starting point for discussion.\n---\n commit.h   |    2 ++\n log-tree.c |   15 +++++++++++++++\n pretty.c   |   23 ++++++++++++++++++-----\n 3 files changed, 35 insertions(+), 5 deletions(-)\n\ndiff --git a/commit.h b/commit.h\nindex e5332ef..e4222b0 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -59,6 +59,8 @@ enum cmit_fmt {\n \tCMIT_FMT_ONELINE,\n \tCMIT_FMT_EMAIL,\n \tCMIT_FMT_USERFORMAT,\n+        CMIT_FMT_COMMITTER_AND_DATE,\n+        CMIT_FMT_AUTHOR_AND_DATE,\n \n \tCMIT_FMT_UNSPECIFIED,\n };\ndiff --git a/log-tree.c b/log-tree.c\nindex 0fdf159..7b399b8 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -160,6 +160,20 @@ static void append_signoff(struct strbuf *sb, const char *signoff)\n \tstrbuf_addch(sb, '\\n');\n }\n \n+static void append_metadata(struct strbuf *sb,\n+                            struct commit *commit,\n+                            const struct pretty_print_context *ctx)\n+{\n+\n+\tstrbuf_addch(sb, '\\n');\n+\tstrbuf_addstr(sb, \" Author:     \");\n+        pretty_print_commit(CMIT_FMT_AUTHOR_AND_DATE, commit, sb, ctx);\n+\n+\tstrbuf_addch(sb, '\\n');\n+\tstrbuf_addstr(sb, \" Committer:  \");\n+        pretty_print_commit(CMIT_FMT_COMMITTER_AND_DATE, commit, sb, ctx);\n+}\n+\n static unsigned int digits_in_number(unsigned int number)\n {\n \tunsigned int i = 10, result = 1;\n@@ -414,6 +428,7 @@ void show_log(struct rev_info *opt)\n \tctx.reflog_info = opt->reflog_info;\n \tpretty_print_commit(opt->commit_format, commit, &msgbuf, &ctx);\n \n+        append_metadata(&msgbuf, commit, &ctx);\n \tif (opt->add_signoff)\n \t\tappend_signoff(&msgbuf, opt->add_signoff);\n \tif (opt->show_log_size) {\ndiff --git a/pretty.c b/pretty.c\nindex 8f5bd1a..2458509 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1028,16 +1028,26 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \tint need_8bit_cte = context->need_8bit_cte;\n \n \tif (fmt == CMIT_FMT_USERFORMAT) {\n-\t\tformat_commit_message(commit, user_format, sb, context);\n+                format_commit_message(commit, user_format, sb, context);\n \t\treturn;\n \t}\n+        if (fmt == CMIT_FMT_COMMITTER_AND_DATE) {\n+                format_commit_message(commit, \"%cn <%ce> %cd\", sb, context);\n+                return;\n+        }\n+        if (fmt == CMIT_FMT_AUTHOR_AND_DATE) {\n+                format_commit_message(commit, \"%an <%ae> %ad\", sb, context);\n+                return;\n+        }\n \n \treencoded = reencode_commit_message(commit, &encoding);\n \tif (reencoded) {\n \t\tmsg = reencoded;\n \t}\n \n-\tif (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)\n+\n+\tif (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL ||\n+            fmt == CMIT_FMT_COMMITTER_AND_DATE || CMIT_FMT_AUTHOR_AND_DATE)\n \t\tindent = 0;\n \n \t/*\n@@ -1078,12 +1088,14 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \t\t\t      context->after_subject, encoding, need_8bit_cte);\n \n \tbeginning_of_body = sb->len;\n-\tif (fmt != CMIT_FMT_ONELINE)\n+\tif (fmt != CMIT_FMT_ONELINE &&\n+            fmt != CMIT_FMT_COMMITTER_AND_DATE && fmt != CMIT_FMT_AUTHOR_AND_DATE)\n \t\tpp_remainder(fmt, &msg, sb, indent);\n \tstrbuf_rtrim(sb);\n \n \t/* Make sure there is an EOLN for the non-oneline case */\n-\tif (fmt != CMIT_FMT_ONELINE)\n+\tif (fmt != CMIT_FMT_ONELINE &&\n+            fmt != CMIT_FMT_COMMITTER_AND_DATE && fmt != CMIT_FMT_AUTHOR_AND_DATE)\n \t\tstrbuf_addch(sb, '\\n');\n \n \t/*\n@@ -1094,7 +1106,8 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \tif (fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)\n \t\tstrbuf_addch(sb, '\\n');\n \n-\tif (fmt != CMIT_FMT_ONELINE)\n+\tif (fmt != CMIT_FMT_ONELINE &&\n+            fmt != CMIT_FMT_COMMITTER_AND_DATE && fmt != CMIT_FMT_AUTHOR_AND_DATE)\n \t\tget_commit_notes(commit, sb, encoding,\n \t\t\t\t NOTES_SHOW_HEADER | NOTES_INDENT);\n \n-- \n1.6.4.4\n"},{"id":"131254","messageId":"xuu28wc59r9n.fsf@nowhere.com","threadId":"22095","inReplyTo":"xuu2fx6d9rzb.fsf_-_@nowhere.com","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-11T04:53:08Z","receivedAt":"2010-01-11T04:53:08Z","isPatch":true,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nAdam Megacz <adam@megacz.com> writes:\n> either taken from the working tree or else displayed to the user for\n> sanity checking purposes.  Since the author/committer information is\n> immutable and not taken from the working tree,\n\ns/working tree/index/g\n\nSorry,\n\n  - a\n"},{"id":"131261","messageId":"7vzl4lw160.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"xuu2fx6d9rzb.fsf_-_@nowhere.com","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-11T07:28:23Z","receivedAt":"2010-01-11T07:28:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Megacz <adam@megacz.com> writes:\n\n> Display author (name, email, date) and committer (name, email, date)\n> after creating a new commit to ensure that the user is alerted in the\n> event that they are set in an undesirable manner.\n\nToo much clutter for too little gain, except for a very first few commits\nin the repository.\n\nWhy isn't the \"# Author:\" and \"# Committer:\" information you see along\nwith \"git status\" output in the editor \"git commit\" gives you sufficient\nif it is to avoid unconfigured/misconfigured names and e-mail addresses?\n\n> This patch is not necessarily meant for inclusion verbatim;\n> ...\n> diff --git a/pretty.c b/pretty.c\n> index 8f5bd1a..2458509 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -1028,16 +1028,26 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n>  \tint need_8bit_cte = context->need_8bit_cte;\n>  \n>  \tif (fmt == CMIT_FMT_USERFORMAT) {\n> -\t\tformat_commit_message(commit, user_format, sb, context);\n> +                format_commit_message(commit, user_format, sb, context);\n\nOf course it isn't, with a change like this ;-)\n\nIndentation damages aside, there is a lot more serious issue with this.\nYou added this cruft *unconditionally* to show_log().  Doesn't it mean\nthat you made format-patch *unusable*?  Try:\n\n\tgit am your_patch.mbox\n        make install\n\tfor i in 1 2 3 4 5\n        do\n                git format-patch -1 --stdout >patch.mbox\n                git reset --hard HEAD^\n                git am patch.mbox\n\tdone        \n\tgit show -s\n\nand weep.\n\nHave you checked --pretty=fuller, by the way?\n"},{"id":"131333","messageId":"xuu2zl4kks3s.fsf@nowhere.com","threadId":"22095","inReplyTo":"7vzl4lw160.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-12T01:51:51Z","receivedAt":"2010-01-12T01:51:51Z","isPatch":true,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> writes:\n> Why isn't the \"# Author:\" and \"# Committer:\" information you see along\n> with \"git status\" output in the editor \"git commit\" gives you sufficient\n> if it is to avoid unconfigured/misconfigured names and e-mail\n> addresses?\n\nIt is sufficient!  But, as others have mentioned, it is not displayed\nwhen \"git commit -m\" is used.  The patch in this thread rectifies that\nomission.\n\n> Too much clutter for too little gain, except for a very first few commits\n> in the repository.\n\nFunny, I think of those \"+++\" \"-----\" histogram things as clutter.  I\nguess it's subjective.\n\n  - a\n"},{"id":"131372","messageId":"20100112142405.GA13369@coredump.intra.peff.net","threadId":"22095","inReplyTo":"xuu2zl4kks3s.fsf@nowhere.com","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T14:24:06Z","receivedAt":"2010-01-12T14:24:06Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 01:51:51AM +0000, Adam Megacz wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> > Why isn't the \"# Author:\" and \"# Committer:\" information you see along\n> > with \"git status\" output in the editor \"git commit\" gives you sufficient\n> > if it is to avoid unconfigured/misconfigured names and e-mail\n> > addresses?\n> \n> It is sufficient!  But, as others have mentioned, it is not displayed\n> when \"git commit -m\" is used.  The patch in this thread rectifies that\n> omission.\n\nI think it is sensible to reiterate the information in the summary for\nthe \"interesting\" cases, as it does make it available to people who do\nnot see the template, and as the uncommon case, is not usually\ncluttering the output.\n\nBut I don't understand why the original patch needed to touch anything\noutside of builtin-commit.c:print_summary. Something like this should\nwork (though see below for why it isn't ready for inclusion):\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 1e353f6..6ee6b10 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -1054,9 +1054,12 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n {\n \tstruct rev_info rev;\n \tstruct commit *commit;\n-\tstatic const char *format = \"format:%h] %s\";\n+\tstruct strbuf format = STRBUF_INIT;\n \tunsigned char junk_sha1[20];\n \tconst char *head = resolve_ref(\"HEAD\", junk_sha1, 0, NULL);\n+\tstruct pretty_print_context pctx = {0};\n+\tstruct strbuf author_ident = STRBUF_INIT;\n+\tstruct strbuf committer_ident = STRBUF_INIT;\n \n \tcommit = lookup_commit(sha1);\n \tif (!commit)\n@@ -1064,6 +1067,22 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tif (!commit || parse_commit(commit))\n \t\tdie(\"could not parse newly created commit\");\n \n+\tstrbuf_addstr(&format, \"format:%h] %s\");\n+\n+\tformat_commit_message(commit, \"%an <%ae>\", &author_ident, &pctx);\n+\tformat_commit_message(commit, \"%cn <%ce>\", &committer_ident, &pctx);\n+\tif (strbuf_cmp(&author_ident, &committer_ident)) {\n+\t\tint i;\n+\t\tstrbuf_addstr(&format, \"\\n Author: \");\n+\t\tfor (i = 0; i < author_ident.len; i++) {\n+\t\t\tif (author_ident.buf[i] == '%')\n+\t\t\t\tstrbuf_addch(&format, '%');\n+\t\t\tstrbuf_addch(&format, author_ident.buf[i]);\n+\t\t}\n+\t}\n+\tstrbuf_release(&author_ident);\n+\tstrbuf_release(&committer_ident);\n+\n \tinit_revisions(&rev, prefix);\n \tsetup_revisions(0, NULL, &rev, NULL);\n \n@@ -1074,7 +1093,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \n \trev.verbose_header = 1;\n \trev.show_root_diff = 1;\n-\tget_commit_format(format, &rev);\n+\tget_commit_format(format.buf, &rev);\n+\tstrbuf_release(&format);\n \trev.always_show_header = 0;\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n@@ -1093,7 +1113,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \t\tstruct pretty_print_context ctx = {0};\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tctx.date_mode = DATE_NORMAL;\n-\t\tformat_commit_message(commit, format + 7, &buf, &ctx);\n+\t\tformat_commit_message(commit, format.buf + 7, &buf, &ctx);\n \t\tprintf(\"%s\\n\", buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\n\nIt's not appropriate for inclusion because:\n\n  - I didn't actually test it beyond \"GIT_AUTHOR_NAME=Foo git commit\n    -m\". I think what the code does is correct, but it may be breaking\n    output in the test suite.\n\n  - It tries to quote any percents in the author name, but user formats\n    don't actually have a quoting mechanism! Probably we should\n    interpret \"%%\" as \"%\". Even though it's a behavior change, I\n    consider the current behavior buggy.\n\n    Side note: it feels a little hack-ish that I have to actually use a\n    user-format to get the author and committer. But we don't seem to\n    have any infrastructure for something as simple as \"give me a string\n    with the author name of this commit\".\n\n  - It only handles author != committer as interesting. We should also\n    check user_ident_explicitly_given and show the committer in that\n    case, as the editor template does.\n\n-Peff\n"},{"id":"131373","messageId":"20100112145212.GA11053@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112142405.GA13369@coredump.intra.peff.net","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T14:52:12Z","receivedAt":"2010-01-12T14:52:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 09:24:06AM -0500, Jeff King wrote:\n\n>   - It tries to quote any percents in the author name, but user formats\n>     don't actually have a quoting mechanism! Probably we should\n>     interpret \"%%\" as \"%\". Even though it's a behavior change, I\n>     consider the current behavior buggy.\n\nActually, on second thought, they do: you can use %x25 to get the same\neffect. I still think we should support '%%' as a more readable and\nexpected alternative (this is how printf works, and daemon.c's expansion\nalready does this).\n\n-Peff\n"},{"id":"131374","messageId":"20100112153656.GA24840@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112142405.GA13369@coredump.intra.peff.net","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T15:36:56Z","receivedAt":"2010-01-12T15:36:56Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 09:24:05AM -0500, Jeff King wrote:\n\n> But I don't understand why the original patch needed to touch anything\n> outside of builtin-commit.c:print_summary. Something like this should\n> work (though see below for why it isn't ready for inclusion):\n\nWell, I had originally meant to send this off and try to convince Adam\nto fix it up for inclusion, but it seemed easy enough so I just went\nahead and did it.\n\n  [1/3]: strbuf_expand: convert \"%%\" to \"%\"\n  [2/3]: strbuf: add strbuf_percentquote_buf\n  [3/3]: commit: show interesting ident information in summary\n\n-Peff\n"},{"id":"131380","messageId":"20100112154100.GA24957@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112153656.GA24840@coredump.intra.peff.net","subject":"[PATCH 1/3] strbuf_expand: convert \"%%\" to \"%\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T15:41:00Z","receivedAt":"2010-01-12T15:41:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The only way to safely quote arbitrary text in a\npretty-print user format is to replace instances of \"%\" with\n\"%x25\". This is slightly unreadable, and many users would\nexpect \"%%\" to produce a single \"%\", as that is what printf\nformat specifiers do.\n\nThis patch converts \"%%\" to \"%\" for all users of\nstrbuf_expand:\n\n 1. git-daemon interpolated paths\n\n 2. pretty-print user formats\n\n 3. merge driver command lines\n\nCase (1) was already doing the conversion itself outside of\nstrbuf_expand. Case (2) is the intended beneficiary of this\npatch. Case (3) users probably won't notice, but as this is\nuser-facing behavior, consistently providing the quoting\nmechanism makes sense.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nBecause of the %x25 thing, this isn't strictly necessary for my series.\nI do think it's the right thing to do, though. If you want to drop it\nbecause of the user-visible behavior change, I can re-roll the rest of\nmy series around %x25 quoting (though it makes the helper in 2/3 less\nuseful, as the quoting doesn't work for printf anymore).\n\n Documentation/pretty-formats.txt |    1 +\n daemon.c                         |    1 -\n strbuf.c                         |    6 ++++++\n t/t6006-rev-list-format.sh       |    7 +++++++\n 4 files changed, 14 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 53a9168..1686a54 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -134,6 +134,7 @@ The placeholders are:\n - '%C(...)': color specification, as described in color.branch.* config option\n - '%m': left, right or boundary mark\n - '%n': newline\n+- '%%': a raw '%'\n - '%x00': print a byte from a hex code\n - '%w([<w>[,<i1>[,<i2>]]])': switch line wrapping, like the -w option of\n   linkgit:git-shortlog[1].\ndiff --git a/daemon.c b/daemon.c\nindex 918e560..360635e 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -147,7 +147,6 @@ static char *path_ok(char *directory)\n \t\t\t{ \"IP\", ip_address },\n \t\t\t{ \"P\", tcp_port },\n \t\t\t{ \"D\", directory },\n-\t\t\t{ \"%\", \"%\" },\n \t\t\t{ NULL }\n \t\t};\n \ndiff --git a/strbuf.c b/strbuf.c\nindex a6153dc..6cbc1fc 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -227,6 +227,12 @@ void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,\n \t\t\tbreak;\n \t\tformat = percent + 1;\n \n+\t\tif (*format == '%') {\n+\t\t\tstrbuf_addch(sb, '%');\n+\t\t\tformat++;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tconsumed = fn(sb, format, context);\n \t\tif (consumed)\n \t\t\tformat += consumed;\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 5719315..b0047d3 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -19,6 +19,13 @@ test_cmp expect.$1 output.$1\n \"\n }\n \n+test_format percent %%h <<'EOF'\n+commit 131a310eb913d107dd3c09a65d1651175898735d\n+%h\n+commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+%h\n+EOF\n+\n test_format hash %H%n%h <<'EOF'\n commit 131a310eb913d107dd3c09a65d1651175898735d\n 131a310eb913d107dd3c09a65d1651175898735d\n-- \n1.6.6.138.g309fc.dirty\n"},{"id":"131381","messageId":"20100112154153.GB24957@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112153656.GA24840@coredump.intra.peff.net","subject":"[PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T15:41:53Z","receivedAt":"2010-01-12T15:41:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is handy for creating strings which will be fed to\nstrbuf_expand or printf.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/technical/api-strbuf.txt |    7 +++++++\n strbuf.c                               |   10 ++++++++++\n strbuf.h                               |    1 +\n 3 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt\nindex a0e0f85..d5ae3b0 100644\n--- a/Documentation/technical/api-strbuf.txt\n+++ b/Documentation/technical/api-strbuf.txt\n@@ -214,6 +214,13 @@ which can be used by the programmer of the callback as she sees fit.\n \tplaceholder and replacement string.  The array needs to be\n \tterminated by an entry with placeholder set to NULL.\n \n+`strbuf_percentquote_buf`::\n+\n+\tAppend the contents of one strbuf to another, quoting any\n+\tpercent signs (\"%\") into double-percents (\"%%\") in the\n+\tdestination. This is useful for literal data to be fed to either\n+\tstrbuf_expand or to the *printf family of functions.\n+\n `strbuf_addf`::\n \n \tAdd a formatted string to the buffer.\ndiff --git a/strbuf.c b/strbuf.c\nindex 6cbc1fc..b5183c6 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -257,6 +257,16 @@ size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder,\n \treturn 0;\n }\n \n+void strbuf_percentquote_buf(struct strbuf *dest, struct strbuf *src)\n+{\n+\tint i;\n+\tfor (i = 0; i < src->len; i++) {\n+\t\tif (src->buf[i] == '%')\n+\t\t\tstrbuf_addch(dest, '%');\n+\t\tstrbuf_addch(dest, src->buf[i]);\n+\t}\n+}\n+\n size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)\n {\n \tsize_t res;\ndiff --git a/strbuf.h b/strbuf.h\nindex fa07ecf..f6bf055 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -116,6 +116,7 @@ struct strbuf_expand_dict_entry {\n \tconst char *value;\n };\n extern size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder, void *context);\n+extern void strbuf_percentquote_buf(struct strbuf *dest, struct strbuf *src);\n \n __attribute__((format (printf,2,3)))\n extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);\n-- \n1.6.6.138.g309fc.dirty\n"},{"id":"131382","messageId":"20100112154631.GC24957@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112153656.GA24840@coredump.intra.peff.net","subject":"[PATCH 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T15:46:32Z","receivedAt":"2010-01-12T15:46:32Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"There are a few cases of user identity information that we\nconsider interesting:\n\n  1. When the author and committer identities do not match.\n\n  2. When the committer identity was picked automatically\n     from the username, hostname and GECOS information.\n\nIn these cases, we already show the information in the\ncommit message template. However, users do not always see\nthat template because they might use \"-m\" or \"-F\". With this\npatch, we show these interesting cases after the commit,\nalong with the subject and change summary. The new output\nlooks like:\n\n  $ git commit \\\n      -m \"federalist papers\" \\\n      --author='Publius <alexander@hamilton.com>'\n  [master 3d226a7] federalist papers\n   Author: Publius <alexander@hamilton.com>\n   1 files changed, 1 insertions(+), 0 deletions(-)\n\nfor case (1), and:\n\n  $ git config --global --unset user.name\n  $ git config --global --unset user.email\n  $ git commit -m foo\n  [master 7c2a927] foo\n   Committer: Jeff King <peff@c-71-185-130-222.hsd1.va.comcast.net>\n   1 files changed, 1 insertions(+), 0 deletions(-)\n\nfor case (2).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nNote that this has a slight semantic conflict with the jc/ident topic in\nnext. The user_ident_explicitly_given flag needs to be compared to\nIDENT_ALL.\n\nI hope the example output in the commit message is not too verbose. I\nwas recently reviewing somebody's series that made output changes, and\nthey didn't include sample output anywhere, which made reviewing a lot\nmore annoying.\n\nPersonally I don't care much about case (2) one way or the other, but it\nis the one that triggered this thread. I think case (1) is very useful,\nthough.\n\nI tested case (2) manually, but I didn't include anything in the test\nsuite; I feel funny testing output created from the hostname and GECOS\n(can't it even barf if the user's system isn't set up very well? That\nwould produce a false negative for the test).\n\n builtin-commit.c  |   25 ++++++++++++++++++++++---\n t/t7501-commit.sh |    6 +++++-\n 2 files changed, 27 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 073fe90..279145d 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -1046,9 +1046,12 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n {\n \tstruct rev_info rev;\n \tstruct commit *commit;\n-\tstatic const char *format = \"format:%h] %s\";\n+\tstruct strbuf format = STRBUF_INIT;\n \tunsigned char junk_sha1[20];\n \tconst char *head = resolve_ref(\"HEAD\", junk_sha1, 0, NULL);\n+\tstruct pretty_print_context pctx = {0};\n+\tstruct strbuf author_ident = STRBUF_INIT;\n+\tstruct strbuf committer_ident = STRBUF_INIT;\n \n \tcommit = lookup_commit(sha1);\n \tif (!commit)\n@@ -1056,6 +1059,21 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tif (!commit || parse_commit(commit))\n \t\tdie(\"could not parse newly created commit\");\n \n+\tstrbuf_addstr(&format, \"format:%h] %s\");\n+\n+\tformat_commit_message(commit, \"%an <%ae>\", &author_ident, &pctx);\n+\tformat_commit_message(commit, \"%cn <%ce>\", &committer_ident, &pctx);\n+\tif (strbuf_cmp(&author_ident, &committer_ident)) {\n+\t\tstrbuf_addstr(&format, \"\\n Author: \");\n+\t\tstrbuf_percentquote_buf(&format, &author_ident);\n+\t}\n+\tif (!user_ident_explicitly_given) {\n+\t\tstrbuf_addstr(&format, \"\\n Committer: \");\n+\t\tstrbuf_percentquote_buf(&format, &committer_ident);\n+\t}\n+\tstrbuf_release(&author_ident);\n+\tstrbuf_release(&committer_ident);\n+\n \tinit_revisions(&rev, prefix);\n \tsetup_revisions(0, NULL, &rev, NULL);\n \n@@ -1066,7 +1084,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \n \trev.verbose_header = 1;\n \trev.show_root_diff = 1;\n-\tget_commit_format(format, &rev);\n+\tget_commit_format(format.buf, &rev);\n+\tstrbuf_release(&format);\n \trev.always_show_header = 0;\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n@@ -1085,7 +1104,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \t\tstruct pretty_print_context ctx = {0};\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tctx.date_mode = DATE_NORMAL;\n-\t\tformat_commit_message(commit, format + 7, &buf, &ctx);\n+\t\tformat_commit_message(commit, format.buf + 7, &buf, &ctx);\n \t\tprintf(\"%s\\n\", buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex a529701..7940901 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -117,7 +117,11 @@ test_expect_success \\\n test_expect_success \\\n \t\"overriding author from command line\" \\\n \t\"echo 'gak' >file && \\\n-\t git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a\"\n+\t git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a >output 2>&1\"\n+\n+test_expect_success \\\n+\t\"commit --author output mentions author\" \\\n+\t\"grep Rubber.Duck output\"\n \n test_expect_success PERL \\\n \t\"interactive add\" \\\n-- \n1.6.6.138.g309fc.dirty\n"},{"id":"131384","messageId":"20100112161859.GA5649@coredump.intra.peff.net","threadId":"22095","inReplyTo":"alpine.DEB.1.00.1001121718210.4985@pacific.mpi-cbg.de","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-12T16:18:59Z","receivedAt":"2010-01-12T16:18:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 05:19:21PM +0100, Johannes Schindelin wrote:\n\n> > This is handy for creating strings which will be fed to\n> > strbuf_expand or printf.\n> \n> For printf(), there is always %s%s, so I would not say your patch is \n> useful there, but rather adds churn: first you add a percent, then you \n> strip it away again.\n\nTrue. It is only useful in either case if you are going to pass the\nformat specifier through an API that does all of its work at once (e.g.,\nin this instance, I would be happy to simply output my strings at the\nright moment, but I need to get them _between_ the log format and the\ndiff summary, which means I need to hide them in the log format\nspecifier). That tends not to happen with printf-style strings, since we\ndon't build complex APIs around them.\n\n-Peff\n"},{"id":"131383","messageId":"alpine.DEB.1.00.1001121718210.4985@pacific.mpi-cbg.de","threadId":"22095","inReplyTo":"20100112154153.GB24957@coredump.intra.peff.net","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-01-12T16:19:21Z","receivedAt":"2010-01-12T16:19:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 12 Jan 2010, Jeff King wrote:\n\n> This is handy for creating strings which will be fed to\n> strbuf_expand or printf.\n\nFor printf(), there is always %s%s, so I would not say your patch is \nuseful there, but rather adds churn: first you add a percent, then you \nstrip it away again.\n\nCiao,\nDscho\n"},{"id":"131425","messageId":"7viqb6trwu.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100112154153.GB24957@coredump.intra.peff.net","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T06:55:45Z","receivedAt":"2010-01-13T06:55:45Z","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> +`strbuf_percentquote_buf`::\n> +\n> +\tAppend the contents of one strbuf to another, quoting any\n> +\tpercent signs (\"%\") into double-percents (\"%%\") in the\n> +\tdestination. This is useful for literal data to be fed to either\n> +\tstrbuf_expand or to the *printf family of functions.\n> +\n>  `strbuf_addf`::\n>  \n>  \tAdd a formatted string to the buffer.\n> diff --git a/strbuf.c b/strbuf.c\n> index 6cbc1fc..b5183c6 100644\n> --- a/strbuf.c\n> +++ b/strbuf.c\n> @@ -257,6 +257,16 @@ size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder,\n>  \treturn 0;\n>  }\n>  \n> +void strbuf_percentquote_buf(struct strbuf *dest, struct strbuf *src)\n> +{\n\nJust a style thing, but please call that \"dst\" to be consistent.  You are\nalready dropping vowels from the other side to spell it \"src\".\n\nI wondered if the function should be just 1-arg that always quotes\nin-place instead, but your [PATCH 3/3] wants to have an appending\nsemantics from this function, so changing it to be a 1-arg \"in-place\nquoter\" will force the caller to run strbuf_addbuf() on the result, which\nis not nice.\n\nSince tucking a p-quoted version of the same string to its original\ndoesn't make sense at all, perhaps this should:\n\n (0) be renamed to have \"append\" somewhere in its name;\n\n (1) mark the src side as const; and\n\n (2) perhaps have assert(dst != src).  The loop won't terminate when\n     called with src == dst, I think.\n\nThere seems to be only one other strbuf function that takes two strbufs in\nthe suite (strbuf_addbuf), and I think it is unsafe in a different way,\nwhich is trivial to fix.\n\n-- >8 --\n\nSubject: [PATCH] strbuf_addbuf(): allow passing the same buf to dst and src\n\nIf sb and sb2 are the same (i.e. doubling the string), the underlying\nstrbuf_add() will make sb2->buf invalid by calling strbuf_grow(sb) at\nthe beginning and will read from the freed buffer.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n strbuf.h |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/strbuf.h b/strbuf.h\nindex fa07ecf..e272359 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -105,7 +105,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s) {\n \tstrbuf_add(sb, s, strlen(s));\n }\n static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) {\n-\tstrbuf_add(sb, sb2->buf, sb2->len);\n+\tchar *buf = sb2->buf;\n+\tint len = sb2->len;\n+\tif (sb->buf == sb2->buf) {\n+\t\tstrbuf_grow(sb, len);\n+\t\tbuf = sb->buf;\n+\t}\n+\tstrbuf_add(sb, buf, len);\n }\n extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len);\n \n-- \n1.6.6.280.ge295b7.dirty\n"},{"id":"131435","messageId":"7v3a2asda8.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100112154631.GC24957@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T06:57:03Z","receivedAt":"2010-01-13T06:57:03Z","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> +\tif (strbuf_cmp(&author_ident, &committer_ident)) {\n> +\t\tstrbuf_addstr(&format, \"\\n Author: \");\n> +\t\tstrbuf_percentquote_buf(&format, &author_ident);\n> +\t}\n> +\tif (!user_ident_explicitly_given) {\n> +\t\tstrbuf_addstr(&format, \"\\n Committer: \");\n> +\t\tstrbuf_percentquote_buf(&format, &committer_ident);\n> +\t}\n\nThis is much better.\n\nWe might want an advice message inside the latter case, helping the user\nlearn how to spell his name correctly.  This is designed to trigger for\npeople/repositories that are not configured, and by definition the\nmajority of that target audience are new people.\n\nThe extra message will disappear once committer information is explicitly\ngiven, there is no need to protect the advice message with the usual\n\"advice.*\" configuration.\n\nThanks.\n"},{"id":"131491","messageId":"20100113170636.GA21318@coredump.intra.peff.net","threadId":"22095","inReplyTo":"7viqb6trwu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:06:36Z","receivedAt":"2010-01-13T17:06:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 10:55:45PM -0800, Junio C Hamano wrote:\n\n> > +void strbuf_percentquote_buf(struct strbuf *dest, struct strbuf *src)\n> > +{\n> \n> Just a style thing, but please call that \"dst\" to be consistent.  You are\n> already dropping vowels from the other side to spell it \"src\".\n\nI personally dislike that spelling, but it certainly is consistent with\nthe rest of git, so OK.\n\n> I wondered if the function should be just 1-arg that always quotes\n> in-place instead, but your [PATCH 3/3] wants to have an appending\n> semantics from this function, so changing it to be a 1-arg \"in-place\n> quoter\" will force the caller to run strbuf_addbuf() on the result, which\n> is not nice.\n\nYep. An in-place version would be a bit more complicated to write, and\nwould make the caller do extra work.\n\n> Since tucking a p-quoted version of the same string to its original\n> doesn't make sense at all, perhaps this should:\n> \n>  (0) be renamed to have \"append\" somewhere in its name;\n\nYeah, I considered this. To follow the existing naming conventions, the\nname should indicate:\n\n  1. it's a strbuf function\n  2. it's appending (and the pattern is to use \"add\")\n  3. it's appending a strbuf (and the pattern is to call this \"buf\")\n  4. it's percent-quoting\n\nSo perhaps following the existing standards, it should be\nstrbuf_addbuf_percentquote? Long, but I don't think there is any\nconfusion about what it does (and leaves room for addstr_percentquote).\n\n>  (1) mark the src side as const; and\n\nOops, good catch.\n\n>  (2) perhaps have assert(dst != src).  The loop won't terminate when\n>      called with src == dst, I think.\n\nOops again. I think it is sensible to protect against this. I thought\nabout trying to make it magically work in-place, but I don't think there\nis a simple way to do so. And since I don't actually need to do that, I\nthink leaving an assert in-place until somebody does need it and wants\nto write it is fine.\n\n> --- a/strbuf.h\n> +++ b/strbuf.h\n> @@ -105,7 +105,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s) {\n>  \tstrbuf_add(sb, s, strlen(s));\n>  }\n>  static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) {\n> -\tstrbuf_add(sb, sb2->buf, sb2->len);\n> +\tchar *buf = sb2->buf;\n> +\tint len = sb2->len;\n> +\tif (sb->buf == sb2->buf) {\n> +\t\tstrbuf_grow(sb, len);\n> +\t\tbuf = sb->buf;\n> +\t}\n> +\tstrbuf_add(sb, buf, len);\n>  }\n\nShouldn't this be \"if (sb == sb2)\"? Two strbufs in the initial state\nwill point to the same strbuf_slopbuf, but obviously growing sb will not\nimpact sb2. Though that would simply provoke a false positive, which I\ndon't think has any negative consequences.\n\nAlso, since reallocating sb will reallocate sb2, can't you just write it\nsafely like this:\n\n  strbuf_grow(sb, sb2->len);\n  strbuf_add(sb, sb2->buf, sb2->len);\n\nThe grow will not affect the length of sb2, so that doesn't need to be\nsaved. And there is no point in deciding whether to point the buf you\npass at sb->buf or sb2->buf. If they are the same, then the grow will\nhave reallocated sb2 as well as sb, and they are identical. And if they\nare not, then sb2->buf is the right thing to pass.\n\n-Peff\n"},{"id":"131496","messageId":"20100113173050.GB21318@coredump.intra.peff.net","threadId":"22095","inReplyTo":"7v3a2asda8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:30:50Z","receivedAt":"2010-01-13T17:30:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 10:57:03PM -0800, Junio C Hamano wrote:\n\n> > +\tif (!user_ident_explicitly_given) {\n> > +\t\tstrbuf_addstr(&format, \"\\n Committer: \");\n> > +\t\tstrbuf_percentquote_buf(&format, &committer_ident);\n> > +\t}\n> \n> This is much better.\n> \n> We might want an advice message inside the latter case, helping the user\n> learn how to spell his name correctly.  This is designed to trigger for\n> people/repositories that are not configured, and by definition the\n> majority of that target audience are new people.\n> \n> The extra message will disappear once committer information is explicitly\n> given, there is no need to protect the advice message with the usual\n> \"advice.*\" configuration.\n\nJust adding the \"Committer:\" reminder is slightly annoying (though\nperhaps some people will even like it). Adding a big advice message on\nevery commit is going to be annoying to everyone who sees it, and is\nreally crossing the line of \"we don't really support implicit identities\nanymore\", since anyone seeing it is going to want to fix it.\n\nI know there has been some discussion of that area in the last few\nmonths, but I admit I didn't pay any attention. Is that the direction we\nwant to move in? I don't have a particular problem with it, but I want\nto point out that if there _are_ people who really like the implicit\nident feature, we are effectively killing it off for them.\n\n-Peff\n"},{"id":"131498","messageId":"20100113173408.GA16652@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100112153656.GA24840@coredump.intra.peff.net","subject":"Re: [PATCH] Display author and committer after \"git commit\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:34:08Z","receivedAt":"2010-01-13T17:34:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 12, 2010 at 10:36:56AM -0500, Jeff King wrote:\n\n>   [1/3]: strbuf_expand: convert \"%%\" to \"%\"\n>   [2/3]: strbuf: add strbuf_percentquote_buf\n>   [3/3]: commit: show interesting ident information in summary\n\nAnd here's a re-roll based on Junio's comments.\n\n  [1/3]: strbuf_expand: convert \"%%\" to \"%\"\n  [2/3]: strbuf: add strbuf_addbuf_percentquote\n  [3/3]: commit: show interesting ident information in summary\n\n-Peff\n"},{"id":"131499","messageId":"20100113173531.GA16786@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100113173408.GA16652@coredump.intra.peff.net","subject":"[PATCH v2 1/3] strbuf_expand: convert \"%%\" to \"%\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:35:31Z","receivedAt":"2010-01-13T17:35:31Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The only way to safely quote arbitrary text in a\npretty-print user format is to replace instances of \"%\" with\n\"%x25\". This is slightly unreadable, and many users would\nexpect \"%%\" to produce a single \"%\", as that is what printf\nformat specifiers do.\n\nThis patch converts \"%%\" to \"%\" for all users of\nstrbuf_expand:\n\n 1. git-daemon interpolated paths\n\n 2. pretty-print user formats\n\n 3. merge driver command lines\n\nCase (1) was already doing the conversion itself outside of\nstrbuf_expand. Case (2) is the intended beneficiary of this\npatch. Case (3) users probably won't notice, but as this is\nuser-facing behavior, consistently providing the quoting\nmechanism makes sense.\n\nSigned-off-by: Jeff King <peff@coredump.intra.peff.net>\n---\nChanges from v1:\n  - note change in strbuf api docs\n\n Documentation/pretty-formats.txt       |    1 +\n Documentation/technical/api-strbuf.txt |    4 ++++\n daemon.c                               |    1 -\n strbuf.c                               |    6 ++++++\n t/t6006-rev-list-format.sh             |    7 +++++++\n 5 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 53a9168..1686a54 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -134,6 +134,7 @@ The placeholders are:\n - '%C(...)': color specification, as described in color.branch.* config option\n - '%m': left, right or boundary mark\n - '%n': newline\n+- '%%': a raw '%'\n - '%x00': print a byte from a hex code\n - '%w([<w>[,<i1>[,<i2>]]])': switch line wrapping, like the -w option of\n   linkgit:git-shortlog[1].\ndiff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt\nindex a0e0f85..3b1da10 100644\n--- a/Documentation/technical/api-strbuf.txt\n+++ b/Documentation/technical/api-strbuf.txt\n@@ -199,6 +199,10 @@ character if the letter `n` appears after a `%`.  The function returns\n the length of the placeholder recognized and `strbuf_expand()` skips\n over it.\n +\n+The format `%%` is automatically expanded to a single `%` as a quoting\n+mechanism; callers do not need to handle the `%` placeholder themselves,\n+and the callback function will not be invoked for this placeholder.\n++\n All other characters (non-percent and not skipped ones) are copied\n verbatim to the strbuf.  If the callback returned zero, meaning that the\n placeholder is unknown, then the percent sign is copied, too.\ndiff --git a/daemon.c b/daemon.c\nindex 918e560..360635e 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -147,7 +147,6 @@ static char *path_ok(char *directory)\n \t\t\t{ \"IP\", ip_address },\n \t\t\t{ \"P\", tcp_port },\n \t\t\t{ \"D\", directory },\n-\t\t\t{ \"%\", \"%\" },\n \t\t\t{ NULL }\n \t\t};\n \ndiff --git a/strbuf.c b/strbuf.c\nindex a6153dc..6cbc1fc 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -227,6 +227,12 @@ void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,\n \t\t\tbreak;\n \t\tformat = percent + 1;\n \n+\t\tif (*format == '%') {\n+\t\t\tstrbuf_addch(sb, '%');\n+\t\t\tformat++;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tconsumed = fn(sb, format, context);\n \t\tif (consumed)\n \t\t\tformat += consumed;\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 5719315..b0047d3 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -19,6 +19,13 @@ test_cmp expect.$1 output.$1\n \"\n }\n \n+test_format percent %%h <<'EOF'\n+commit 131a310eb913d107dd3c09a65d1651175898735d\n+%h\n+commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+%h\n+EOF\n+\n test_format hash %H%n%h <<'EOF'\n commit 131a310eb913d107dd3c09a65d1651175898735d\n 131a310eb913d107dd3c09a65d1651175898735d\n-- \n1.6.6.140.g92e4d.dirty\n"},{"id":"131501","messageId":"20100113173642.GB16786@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100113173408.GA16652@coredump.intra.peff.net","subject":"[PATCH v2 2/3] strbuf: add strbuf_addbuf_percentquote","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:36:42Z","receivedAt":"2010-01-13T17:36:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is handy for creating strings which will be fed to\nstrbuf_expand or printf.\n\nSigned-off-by: Jeff King <peff@coredump.intra.peff.net>\n---\nChanges since v1:\n  - better name\n  - style: s/dest/dst/\n  - const src\n  - no infinite loop for src == dst\n\n Documentation/technical/api-strbuf.txt |    7 +++++++\n strbuf.c                               |   11 +++++++++++\n strbuf.h                               |    1 +\n 3 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt\nindex 3b1da10..afe2759 100644\n--- a/Documentation/technical/api-strbuf.txt\n+++ b/Documentation/technical/api-strbuf.txt\n@@ -218,6 +218,13 @@ which can be used by the programmer of the callback as she sees fit.\n \tplaceholder and replacement string.  The array needs to be\n \tterminated by an entry with placeholder set to NULL.\n \n+`strbuf_addbuf_percentquote`::\n+\n+\tAppend the contents of one strbuf to another, quoting any\n+\tpercent signs (\"%\") into double-percents (\"%%\") in the\n+\tdestination. This is useful for literal data to be fed to either\n+\tstrbuf_expand or to the *printf family of functions.\n+\n `strbuf_addf`::\n \n \tAdd a formatted string to the buffer.\ndiff --git a/strbuf.c b/strbuf.c\nindex 6cbc1fc..0c46054 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -257,6 +257,17 @@ size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder,\n \treturn 0;\n }\n \n+void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src)\n+{\n+\tint i;\n+\tassert(dst != src);\n+\tfor (i = 0; i < src->len; i++) {\n+\t\tif (src->buf[i] == '%')\n+\t\t\tstrbuf_addch(dst, '%');\n+\t\tstrbuf_addch(dst, src->buf[i]);\n+\t}\n+}\n+\n size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)\n {\n \tsize_t res;\ndiff --git a/strbuf.h b/strbuf.h\nindex fa07ecf..84ac942 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -116,6 +116,7 @@ struct strbuf_expand_dict_entry {\n \tconst char *value;\n };\n extern size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder, void *context);\n+extern void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src);\n \n __attribute__((format (printf,2,3)))\n extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);\n-- \n1.6.6.140.g92e4d.dirty\n"},{"id":"131502","messageId":"20100113173951.GC16786@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100113173408.GA16652@coredump.intra.peff.net","subject":"[PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T17:39:51Z","receivedAt":"2010-01-13T17:39:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"There are a few cases of user identity information that we\nconsider interesting:\n\n  1. When the author and committer identities do not match.\n\n  2. When the committer identity was picked automatically\n     from the username, hostname and GECOS information.\n\nIn these cases, we already show the information in the\ncommit message template. However, users do not always see\nthat template because they might use \"-m\" or \"-F\". With this\npatch, we show these interesting cases after the commit,\nalong with the subject and change summary. The new output\nlooks like:\n\n  $ git commit \\\n      -m \"federalist papers\" \\\n      --author='Publius <alexander@hamilton.com>'\n  [master 3d226a7] federalist papers\n   Author: Publius <alexander@hamilton.com>\n   1 files changed, 1 insertions(+), 0 deletions(-)\n\nfor case (1), and:\n\n  $ git config --global --unset user.name\n  $ git config --global --unset user.email\n  $ git commit -m foo\n  [master 7c2a927] foo\n   Committer: Jeff King <peff@c-71-185-130-222.hsd1.va.comcast.net>\n  Your name and email address were configured automatically based\n  on your username and hostname. Please check that they are accurate.\n  You can suppress this message by setting them explicitly:\n\n      git config --global user.name Your Name\n      git config --global user.email you@example.com\n\n  If the identity used for this commit is wrong, you can fix it with:\n\n      git commit --amend --author='Your Name <you@example.com>'\n\n   1 files changed, 1 insertions(+), 0 deletions(-)\n\nfor case (2).\n\nSigned-off-by: Jeff King <peff@coredump.intra.peff.net>\n---\nChanges since v1:\n - rebase on v2 2/3 for function name change\n - gigantic warning message\n\nI have mixed feelings on the warning message, as I mentioned elsewhere\nin the thread.\n\nAlso, if you run the \"commit --amend\" advice immediately (without fixing\nyour config), you will still have a bogus committer field. Alternate\nadvice could be:\n\n  If the identity used for this commit is wrong, you can fix it (after\n  having set your identity as above) with:\n\n    git commit --amend --reset-author\n\nI dunno which is better. I went with what I did because it is something\nthe user can immediately do to fix this commit before they forget (of\ncourse, they probably would just run the \"git config\" commands,\nimmediately, too...).\n\n builtin-commit.c  |   39 ++++++++++++++++++++++++++++++++++++---\n t/t7501-commit.sh |    6 +++++-\n 2 files changed, 41 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 073fe90..3fa9b39 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -36,6 +36,18 @@ static const char * const builtin_status_usage[] = {\n \tNULL\n };\n \n+static const char implicit_ident_advice[] =\n+\"Your name and email address were configured automatically based\\n\"\n+\"on your username and hostname. Please check that they are accurate.\\n\"\n+\"You can suppress this message by setting them explicitly:\\n\"\n+\"\\n\"\n+\"    git config --global user.name Your Name\\n\"\n+\"    git config --global user.email you@example.com\\n\"\n+\"\\n\"\n+\"If the identity used for this commit is wrong, you can fix it with:\\n\"\n+\"\\n\"\n+\"    git commit --amend --author='Your Name <you@example.com>'\\n\";\n+\n static unsigned char head_sha1[20];\n static char *use_message_buffer;\n static const char commit_editmsg[] = \"COMMIT_EDITMSG\";\n@@ -1046,9 +1058,12 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n {\n \tstruct rev_info rev;\n \tstruct commit *commit;\n-\tstatic const char *format = \"format:%h] %s\";\n+\tstruct strbuf format = STRBUF_INIT;\n \tunsigned char junk_sha1[20];\n \tconst char *head = resolve_ref(\"HEAD\", junk_sha1, 0, NULL);\n+\tstruct pretty_print_context pctx = {0};\n+\tstruct strbuf author_ident = STRBUF_INIT;\n+\tstruct strbuf committer_ident = STRBUF_INIT;\n \n \tcommit = lookup_commit(sha1);\n \tif (!commit)\n@@ -1056,6 +1071,23 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tif (!commit || parse_commit(commit))\n \t\tdie(\"could not parse newly created commit\");\n \n+\tstrbuf_addstr(&format, \"format:%h] %s\");\n+\n+\tformat_commit_message(commit, \"%an <%ae>\", &author_ident, &pctx);\n+\tformat_commit_message(commit, \"%cn <%ce>\", &committer_ident, &pctx);\n+\tif (strbuf_cmp(&author_ident, &committer_ident)) {\n+\t\tstrbuf_addstr(&format, \"\\n Author: \");\n+\t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n+\t}\n+\tif (!user_ident_explicitly_given) {\n+\t\tstrbuf_addstr(&format, \"\\n Committer: \");\n+\t\tstrbuf_addbuf_percentquote(&format, &committer_ident);\n+\t\tstrbuf_addch(&format, '\\n');\n+\t\tstrbuf_addstr(&format, implicit_ident_advice);\n+\t}\n+\tstrbuf_release(&author_ident);\n+\tstrbuf_release(&committer_ident);\n+\n \tinit_revisions(&rev, prefix);\n \tsetup_revisions(0, NULL, &rev, NULL);\n \n@@ -1066,7 +1098,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \n \trev.verbose_header = 1;\n \trev.show_root_diff = 1;\n-\tget_commit_format(format, &rev);\n+\tget_commit_format(format.buf, &rev);\n+\tstrbuf_release(&format);\n \trev.always_show_header = 0;\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n@@ -1085,7 +1118,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \t\tstruct pretty_print_context ctx = {0};\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tctx.date_mode = DATE_NORMAL;\n-\t\tformat_commit_message(commit, format + 7, &buf, &ctx);\n+\t\tformat_commit_message(commit, format.buf + 7, &buf, &ctx);\n \t\tprintf(\"%s\\n\", buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex a529701..7940901 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -117,7 +117,11 @@ test_expect_success \\\n test_expect_success \\\n \t\"overriding author from command line\" \\\n \t\"echo 'gak' >file && \\\n-\t git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a\"\n+\t git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a >output 2>&1\"\n+\n+test_expect_success \\\n+\t\"commit --author output mentions author\" \\\n+\t\"grep Rubber.Duck output\"\n \n test_expect_success PERL \\\n \t\"interactive add\" \\\n-- \n1.6.6.140.g92e4d.dirty\n"},{"id":"131507","messageId":"1DDB570B-350A-40A0-B6E4-ADBDF4BE6BD2@wincent.com","threadId":"22095","inReplyTo":"20100113173951.GC16786@coredump.intra.peff.net","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2010-01-13T18:39:47Z","receivedAt":"2010-01-13T18:39:47Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 13/01/2010, a las 18:39, Jeff King escribió:\n\n>  $ git config --global --unset user.name\n>  $ git config --global --unset user.email\n>  $ git commit -m foo\n>  [master 7c2a927] foo\n>   Committer: Jeff King <peff@c-71-185-130-222.hsd1.va.comcast.net>\n>  Your name and email address were configured automatically based\n>  on your username and hostname. Please check that they are accurate.\n>  You can suppress this message by setting them explicitly:\n>\n>      git config --global user.name Your Name\n>      git config --global user.email you@example.com\n>\n>  If the identity used for this commit is wrong, you can fix it with:\n>\n>      git commit --amend --author='Your Name <you@example.com>'\n>\n>   1 files changed, 1 insertions(+), 0 deletions(-)\n\nI'll never see this message myself, but I think you could (and perhaps  \nshould) replace almost all of that with:\n\n   Your name and email address were configured automatically.\n   See \"git config help\" for information on setting them explicitly\n   or \"git commit help\" if you wish to amend this commit.\n\nBut like I said, seeing as I won't see the message its verbosity won't  \ndirectly affect me.\n\nCheers,\nWincent"},{"id":"131506","messageId":"20100113184510.GA22849@coredump.intra.peff.net","threadId":"22095","inReplyTo":"1DDB570B-350A-40A0-B6E4-ADBDF4BE6BD2@wincent.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T18:45:10Z","receivedAt":"2010-01-13T18:45:10Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 13, 2010 at 07:39:47PM +0100, Wincent Colaiuta wrote:\n\n> > Your name and email address were configured automatically based\n> > on your username and hostname. Please check that they are accurate.\n> > You can suppress this message by setting them explicitly:\n> >\n> >     git config --global user.name Your Name\n> >     git config --global user.email you@example.com\n> >\n> > If the identity used for this commit is wrong, you can fix it with:\n> >\n> >     git commit --amend --author='Your Name <you@example.com>'\n> >\n> >  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> I'll never see this message myself, but I think you could (and\n> perhaps should) replace almost all of that with:\n> \n>   Your name and email address were configured automatically.\n>   See \"git config help\" for information on setting them explicitly\n>   or \"git commit help\" if you wish to amend this commit.\n\nI don't have a huge problem with your wording, except that it needs\ns/(\\w+) help/help \\1/.\n\nMainly I was trying to hand-hold because not having this information set\nup means it may be your first commit, and you are probably a bit\nclueless (the exceptions are people who have been using git, but are\nseeing this new behavior in their new version, and people who have git\nconfigured on another machine but are using _this_ machine for the first\ntime).\n\nAs far as reducing verbosity goes, I don't think there is much point.\nBoth of ours are huge and annoying enough to nag you into setting up\nyour config, so the user is only likely to see it a few times.\n\n> But like I said, seeing as I won't see the message its verbosity won't\n> directly affect me.\n\nI am also in this boat. :)\n\n-Peff\n"},{"id":"131509","messageId":"5722BD3D-E7C9-47F7-B547-09B14D87DA39@wincent.com","threadId":"22095","inReplyTo":"20100113184510.GA22849@coredump.intra.peff.net","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2010-01-13T18:50:36Z","receivedAt":"2010-01-13T18:50:36Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 13/01/2010, a las 19:45, Jeff King escribió:\n\n> On Wed, Jan 13, 2010 at 07:39:47PM +0100, Wincent Colaiuta wrote:\n>\n>>> Your name and email address were configured automatically based\n>>> on your username and hostname. Please check that they are accurate.\n>>> You can suppress this message by setting them explicitly:\n>>>\n>>>    git config --global user.name Your Name\n>>>    git config --global user.email you@example.com\n>>>\n>>> If the identity used for this commit is wrong, you can fix it with:\n>>>\n>>>    git commit --amend --author='Your Name <you@example.com>'\n>>>\n>>> 1 files changed, 1 insertions(+), 0 deletions(-)\n>>\n>> I'll never see this message myself, but I think you could (and\n>> perhaps should) replace almost all of that with:\n>>\n>>  Your name and email address were configured automatically.\n>>  See \"git config help\" for information on setting them explicitly\n>>  or \"git commit help\" if you wish to amend this commit.\n>\n> I don't have a huge problem with your wording, except that it needs\n> s/(\\w+) help/help \\1/.\n\nWhoops.\n\n> Mainly I was trying to hand-hold because not having this information  \n> set\n> up means it may be your first commit, and you are probably a bit\n> clueless (the exceptions are people who have been using git, but are\n> seeing this new behavior in their new version, and people who have git\n> configured on another machine but are using _this_ machine for the  \n> first\n> time).\n\nFair enough, but I'm sighing here at the thought of people jumping in  \nand using git commands without even having looked at _any_ of the  \nzillions of \"your first 10 minutes with Git\" tutorials out there,  \nwhich pretty much _all_ start with how to set up your user.name and  \nuser.email...\n\nCheers,\nWincent\n"},{"id":"131514","messageId":"7vwrzln5x5.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100113170636.GA21318@coredump.intra.peff.net","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T19:47:18Z","receivedAt":"2010-01-13T19:47:18Z","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>>  (2) perhaps have assert(dst != src).  The loop won't terminate when\n>>      called with src == dst, I think.\n>\n> Oops again. I think it is sensible to protect against this. I thought\n> about trying to make it magically work in-place, but I don't think there\n> is a simple way to do so.\n\nAs I said, I don't think appending p-quoted version of itself to a string\nmakes much sense, but I don't think in-place is too difficult.\n\n\tstrbuf_addbuf_pquote(*dst, *src)\n        {\n\t\tint len = src->len, i;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (src->buf[i] == '%')\n                        \tstrbuf_addch(dst, '%');\n\t\t\tstrbuf_addch(dst, src->buf[i]);\n\t\t}\n        }\n\n>> --- a/strbuf.h\n>> +++ b/strbuf.h\n>> @@ -105,7 +105,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s) {\n>>  \tstrbuf_add(sb, s, strlen(s));\n>>  }\n>>  static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) {\n>> -\tstrbuf_add(sb, sb2->buf, sb2->len);\n>> +\tchar *buf = sb2->buf;\n>> +\tint len = sb2->len;\n>> +\tif (sb->buf == sb2->buf) {\n>> +\t\tstrbuf_grow(sb, len);\n>> +\t\tbuf = sb->buf;\n>> +\t}\n>> +\tstrbuf_add(sb, buf, len);\n>>  }\n>\n> Shouldn't this be \"if (sb == sb2)\"? Two strbufs in the initial state\n> will point to the same strbuf_slopbuf, but obviously growing sb will not\n> impact sb2. Though that would simply provoke a false positive, which I\n> don't think has any negative consequences.\n\nOk, that is a good catch.  And two strbufs that share the same allocated\nstring is a user error\n\n> Also, since reallocating sb will reallocate sb2, can't you just write it\n> safely like this:\n>\n>   strbuf_grow(sb, sb2->len);\n>   strbuf_add(sb, sb2->buf, sb2->len);\n\nI didn't want to worry about a semi-clever (read: broken) compilers doing\nsemi-clever things assuming sb and sb2 do not alias, but I agree that your\napproach is much simpler.\n\nThanks.\n"},{"id":"131517","messageId":"7vbpgxn5ui.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100113173050.GB21318@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T19:48:53Z","receivedAt":"2010-01-13T19:48:53Z","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> Just adding the \"Committer:\" reminder is slightly annoying (though\n> perhaps some people will even like it). Adding a big advice message on\n> every commit is going to be annoying to everyone who sees it, and is\n> really crossing the line of \"we don't really support implicit identities\n> anymore\", since anyone seeing it is going to want to fix it.\n>\n> I know there has been some discussion of that area in the last few\n> months, but I admit I didn't pay any attention. Is that the direction we\n> want to move in? I don't have a particular problem with it, but I want\n> to point out that if there _are_ people who really like the implicit\n> ident feature, we are effectively killing it off for them.\n\nTraditionally, we've only had a minimal sanity check (e.g. to barf when\nthe name is empty, or something silly like that) and tried to come up with\na reasonable name/email given the available system information.\n\nIn olden days, `whoami`@`hostname`, at least on systems that were\ncompetently maintained, gave a reasonable mail address for most people,\nbut I think it stopped being adequate more than 10 years ago, and it is\nnot useful anymore to majority of people, especially the ones who work on\nOpen Source projects as individuals, whose desired public identities are\noften tied to their email account at their ISPs or mailbox providers (like\ngmail).  There is no way for us to guess, when `whoami`@`hostname -f` is\nthe only thing we can go by without explicit user configuration.\n\nInside corporate environments, `whoami`@`hostname -f` might still be a\nreasonable and usable default, though.\n\nSo I think the safest thing to do would be to give a big advice but make\nit squelch-able with advice.howToSetYourIdentity or something.\n"},{"id":"131519","messageId":"20100113195635.GA25265@coredump.intra.peff.net","threadId":"22095","inReplyTo":"7vwrzln5x5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T19:56:35Z","receivedAt":"2010-01-13T19:56:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 13, 2010 at 11:47:18AM -0800, Junio C Hamano wrote:\n\n> As I said, I don't think appending p-quoted version of itself to a string\n> makes much sense, but I don't think in-place is too difficult.\n> \n> \tstrbuf_addbuf_pquote(*dst, *src)\n>         {\n> \t\tint len = src->len, i;\n> \t\tfor (i = 0; i < len; i++) {\n> \t\t\tif (src->buf[i] == '%')\n>                         \tstrbuf_addch(dst, '%');\n> \t\t\tstrbuf_addch(dst, src->buf[i]);\n\nOops, of course. I was still thinking of actually doing a single\nin-place conversion, not appending in-place. Of course yours is right.\nCan you mark up my patch instead of using the assert?\n\n-Peff\n"},{"id":"131525","messageId":"20100113201708.GA23018@coredump.intra.peff.net","threadId":"22095","inReplyTo":"7vbpgxn5ui.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T20:17:08Z","receivedAt":"2010-01-13T20:17:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 13, 2010 at 11:48:53AM -0800, Junio C Hamano wrote:\n\n> In olden days, `whoami`@`hostname`, at least on systems that were\n> competently maintained, gave a reasonable mail address for most people,\n> but I think it stopped being adequate more than 10 years ago, and it is\n> not useful anymore to majority of people, especially the ones who work on\n> Open Source projects as individuals, whose desired public identities are\n> often tied to their email account at their ISPs or mailbox providers (like\n> gmail).  There is no way for us to guess, when `whoami`@`hostname -f` is\n> the only thing we can go by without explicit user configuration.\n\nEven outside of competent maintenance or individuals being served by\nISPs, I think it is really that it is no longer the case that the\nmachines we get our mail on and the machines we do our work on are less\nand less the same. Even as an individual, I can afford a Linux\nworkstation on my desk _and_ one to serve my mail. But I don't advertise\npeff@workstation.peff.net as my email.\n\nWhich isn't to say there aren't people in the separate situation, like:\n\n> Inside corporate environments, `whoami`@`hostname -f` might still be a\n> reasonable and usable default, though.\n> \n> So I think the safest thing to do would be to give a big advice but make\n> it squelch-able with advice.howToSetYourIdentity or something.\n\nI think that is a good idea. Administrators of competent shared\nenvironments can turn off the advice via /etc/gitconfig if they want,\nand everyone else needs to opt into it consciously, which should help\nreduce errors. I'm sure there will still be somebody, somewhere, who\ncomplains about having to set the config, but that minority is hopefully\nsmall enough to justify the errors saved by new git users.\n\nCan you apply the patch below to my series as 4/3?\n\n-- >8 --\nSubject: [PATCH] commit: allow suppression of implicit identity advice\n\nWe now nag the user with a giant warning when their identity\nwas pulled from the username, hostname, and gecos\ninformation, in case it is not correct. Most users will\nsuppress this by simply setting up their information\ncorrectly.\n\nHowever, there may be some users who consciously want to use\nthat information, because having the value change from host\nto host contains useful information. These users can now set\nadvice.implicitidentity to false to suppress the message.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nPretty straightforward. The biggest question is whether to suppress the\n\"Committer: XXX <YYY@ZZZ>\" line, too. I kind of think it is useful if\nyou are intentionally using this feature; by definition if you are using\nit intentionally then the information is of some interest to you.\n\n Documentation/config.txt |    4 ++++\n advice.c                 |    2 ++\n advice.h                 |    1 +\n builtin-commit.c         |    6 ++++--\n 4 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 9f40955..905076f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -130,6 +130,10 @@ advice.*::\n \t\tAdvice shown when linkgit:git-merge[1] refuses to\n \t\tmerge to avoid overwritting local changes.\n \t\tDefault: true.\n+\timplicitIdentity::\n+\t\tAdvice on how to set your identity configuration when\n+\t\tyour information is guessed from the system username and\n+\t\tdomain name. Default: true.\n --\n \n core.fileMode::\ndiff --git a/advice.c b/advice.c\nindex cb666ac..8f7de0e 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -3,6 +3,7 @@\n int advice_push_nonfastforward = 1;\n int advice_status_hints = 1;\n int advice_commit_before_merge = 1;\n+int advice_implicit_identity = 1;\n \n static struct {\n \tconst char *name;\n@@ -11,6 +12,7 @@ static struct {\n \t{ \"pushnonfastforward\", &advice_push_nonfastforward },\n \t{ \"statushints\", &advice_status_hints },\n \t{ \"commitbeforemerge\", &advice_commit_before_merge },\n+\t{ \"implicitidentity\", &advice_implicit_identity },\n };\n \n int git_default_advice_config(const char *var, const char *value)\ndiff --git a/advice.h b/advice.h\nindex 3de5000..728ab90 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -4,6 +4,7 @@\n extern int advice_push_nonfastforward;\n extern int advice_status_hints;\n extern int advice_commit_before_merge;\n+extern int advice_implicit_identity;\n \n int git_default_advice_config(const char *var, const char *value);\n \ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 3fa9b39..d687cf1 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -1082,8 +1082,10 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tif (!user_ident_explicitly_given) {\n \t\tstrbuf_addstr(&format, \"\\n Committer: \");\n \t\tstrbuf_addbuf_percentquote(&format, &committer_ident);\n-\t\tstrbuf_addch(&format, '\\n');\n-\t\tstrbuf_addstr(&format, implicit_ident_advice);\n+\t\tif (advice_implicit_identity) {\n+\t\t\tstrbuf_addch(&format, '\\n');\n+\t\t\tstrbuf_addstr(&format, implicit_ident_advice);\n+\t\t}\n \t}\n \tstrbuf_release(&author_ident);\n \tstrbuf_release(&committer_ident);\n-- \n1.6.6.146.gdaab9.dirty\n"},{"id":"131526","messageId":"20100113201843.GB23018@coredump.intra.peff.net","threadId":"22095","inReplyTo":"20100113201708.GA23018@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-13T20:18:44Z","receivedAt":"2010-01-13T20:18:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 13, 2010 at 03:17:08PM -0500, Jeff King wrote:\n\n> Even outside of competent maintenance or individuals being served by\n> ISPs, I think it is really that it is no longer the case that the\n> machines we get our mail on and the machines we do our work on are less\n> and less the same. Even as an individual, I can afford a Linux\n\nEr, re-reading that I think I have too many negatives. But hopefully you\nget the point: \"it is less and less the case that...\" or \"it is no\nlonger the case that...\"\n\n-Peff\n"},{"id":"131536","messageId":"7vljg1lof1.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100113201843.GB23018@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T20:50:42Z","receivedAt":"2010-01-13T20:50:42Z","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 Wed, Jan 13, 2010 at 03:17:08PM -0500, Jeff King wrote:\n>\n>> Even outside of competent maintenance or individuals being served by\n>> ISPs, I think it is really that it is no longer the case that the\n>> machines we get our mail on and the machines we do our work on are less\n>> and less the same. Even as an individual, I can afford a Linux\n>\n> Er, re-reading that I think I have too many negatives. But hopefully you\n> get the point: \"it is less and less the case that...\" or \"it is no\n> longer the case that...\"\n\nYes, I am in full agreement with everything you wrote in the message you\nare responding to, including the comments after three-dash line about\nshowing the \"Committer: \" line even when the advice.implicitidentity is\ndeclined.\n\nThanks.\n"},{"id":"131639","messageId":"CABC23EF-410F-461C-936F-7BE72E9822BC@pobox.com","threadId":"22095","inReplyTo":"20100113173531.GA16786@coredump.intra.peff.net","subject":"Re: [PATCH v2 1/3] strbuf_expand: convert \"%%\" to \"%\"","fromName":"Chris Johnsen","fromEmail":"chris_johnsen@pobox.com","sentAt":"2010-01-14T11:47:09Z","receivedAt":"2010-01-14T11:47:09Z","isPatch":true,"sender":{"key":"chris_johnsen@pobox.com","avatar":"https://avatars.githubusercontent.com/u/107071?v=4"},"body":"On 2010 Jan 13, at 11:35, Jeff King wrote:\n> Signed-off-by: Jeff King <peff@coredump.intra.peff.net>\n\nThe patches of the v2 of this series (well, except \"4/3\") all use  \nthis surprising, \"extended\" hostname in their Signed-off-by lines. I  \nsuppose you unset user.email while testing the series and sent these  \nout before restoring your normal configuration.\n\nSorry for the noise if this was intentional (a small joke about the  \nauto-configured ident info?).\n\n-- \nChris\n"},{"id":"131646","messageId":"20100114143255.GA15792@sigill.intra.peff.net","threadId":"22095","inReplyTo":"CABC23EF-410F-461C-936F-7BE72E9822BC@pobox.com","subject":"Re: [PATCH v2 1/3] strbuf_expand: convert \"%%\" to \"%\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-14T14:32:55Z","receivedAt":"2010-01-14T14:32:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 14, 2010 at 05:47:09AM -0600, Chris Johnsen wrote:\n\n> On 2010 Jan 13, at 11:35, Jeff King wrote:\n> >Signed-off-by: Jeff King <peff@coredump.intra.peff.net>\n> \n> The patches of the v2 of this series (well, except \"4/3\") all use\n> this surprising, \"extended\" hostname in their Signed-off-by lines. I\n> suppose you unset user.email while testing the series and sent these\n> out before restoring your normal configuration.\n\nHeh. Yes, thank you for noticing. That is exactly what happened. Perhaps\nthe next series should be a huge nag about implicit ident for S-o-b\nlines. ;)\n\nJunio, can you please fix up s/coredump.intra.// in your copies before\npushing out?\n\n-Peff\n"},{"id":"131648","messageId":"201001141602.22244.trast@student.ethz.ch","threadId":"22095","inReplyTo":"5722BD3D-E7C9-47F7-B547-09B14D87DA39@wincent.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-01-14T15:02:21Z","receivedAt":"2010-01-14T15:02:21Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Wincent Colaiuta wrote:\n> \n> Fair enough, but I'm sighing here at the thought of people jumping in  \n> and using git commands without even having looked at _any_ of the  \n> zillions of \"your first 10 minutes with Git\" tutorials out there,  \n> which pretty much _all_ start with how to set up your user.name and  \n> user.email...\n\nIf you really are shocked by that thought, try hanging out on #git for\nsix hours on any given day...\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"131662","messageId":"94a0d4531001141104w74dbaf35jb5fded9e266bc04b@mail.gmail.com","threadId":"22095","inReplyTo":"201001141602.22244.trast@student.ethz.ch","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2010-01-14T19:04:16Z","receivedAt":"2010-01-14T19:04:16Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Jan 14, 2010 at 5:02 PM, Thomas Rast <trast@student.ethz.ch> wrote:\n> Wincent Colaiuta wrote:\n>>\n>> Fair enough, but I'm sighing here at the thought of people jumping in\n>> and using git commands without even having looked at _any_ of the\n>> zillions of \"your first 10 minutes with Git\" tutorials out there,\n>> which pretty much _all_ start with how to set up your user.name and\n>> user.email...\n>\n> If you really are shocked by that thought, try hanging out on #git for\n> six hours on any given day...\n\nWhich is precisely why I was pushing for this:\nhttp://thread.gmane.org/gmane.comp.version-control.git/131150\n\n-- \nFelipe Contreras\n"},{"id":"131663","messageId":"7vy6k0cxbz.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"94a0d4531001141104w74dbaf35jb5fded9e266bc04b@mail.gmail.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-14T19:15:12Z","receivedAt":"2010-01-14T19:15:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Thu, Jan 14, 2010 at 5:02 PM, Thomas Rast <trast@student.ethz.ch> wrote:\n>> Wincent Colaiuta wrote:\n>>>\n>>> Fair enough, but I'm sighing here at the thought of people jumping in\n>>> and using git commands without even having looked at _any_ of the\n>>> zillions of \"your first 10 minutes with Git\" tutorials out there,\n>>> which pretty much _all_ start with how to set up your user.name and\n>>> user.email...\n>>\n>> If you really are shocked by that thought, try hanging out on #git for\n>> six hours on any given day...\n>\n> Which is precisely why I was pushing for this:\n> http://thread.gmane.org/gmane.comp.version-control.git/131150\n\nI think the point of the message you are responding to is that it has\nalready been proven that there are users that never reads any of the\nzillions of \"your first 10 minutes with Git\".  How that _could_ ever\npossibly be the reason/justification why you would want to push that\nchange to our documentation?\n"},{"id":"131665","messageId":"94a0d4531001141136m3eb51d11rafdf7f0672e68dff@mail.gmail.com","threadId":"22095","inReplyTo":"7vy6k0cxbz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2010-01-14T19:36:06Z","receivedAt":"2010-01-14T19:36:06Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Jan 14, 2010 at 9:15 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> I think the point of the message you are responding to is that it has\n> already been proven that there are users that never reads any of the\n> zillions of \"your first 10 minutes with Git\".  How that _could_ ever\n> possibly be the reason/justification why you would want to push that\n> change to our documentation?\n\nUsers are lazy.\n\n-- \nFelipe Contreras\n"},{"id":"131667","messageId":"7vy6k0bheg.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"94a0d4531001141136m3eb51d11rafdf7f0672e68dff@mail.gmail.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-14T19:44:39Z","receivedAt":"2010-01-14T19:44:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Thu, Jan 14, 2010 at 9:15 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> I think the point of the message you are responding to is that it has\n>> already been proven that there are users that never reads any of the\n>> zillions of \"your first 10 minutes with Git\".  How that _could_ ever\n>> possibly be the reason/justification why you would want to push that\n>> change to our documentation?\n>\n> Users are lazy.\n\nAnd the ones that suffer from the issue discussed in this thread will not\nread the manual your patch touches.  When you make changes to the manual,\nyou should not be targetting them, as they won't read it anyway.  Instead,\nthe description of the manual should aim to help people who _read_ it.\n"},{"id":"131697","messageId":"94a0d4531001141721j261facedlf5d1bd9e611c224c@mail.gmail.com","threadId":"22095","inReplyTo":"7vy6k0bheg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2010-01-15T01:21:42Z","receivedAt":"2010-01-15T01:21:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Jan 14, 2010 at 9:44 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Users are lazy.\n>\n> And the ones that suffer from the issue discussed in this thread will not\n> read the manual your patch touches.  When you make changes to the manual,\n> you should not be targetting them, as they won't read it anyway.  Instead,\n> the description of the manual should aim to help people who _read_ it.\n\nThe world is not clear-cut between users who read, and users don't.\nMost probably user laziness follows a Pareto distribution:\nhttp://en.wikipedia.org/wiki/File:Pareto_distributionPDF.png\n\nThe long tail of users who don't read much is so big that you will\nfind *a lot* that don't read anything at all, therefore you would also\nfind many that read a bit, and as a consequence a tiny amount that\nactually would read the whole user manual.\n\nClearly, Thomas' comment implies that some people might need to adjust\ntheir mental model to reflect reality.\n\n-- \nFelipe Contreras\n"},{"id":"131844","messageId":"xuu2hbqm4v1m.fsf@nowhere.com","threadId":"22095","inReplyTo":"5722BD3D-E7C9-47F7-B547-09B14D87DA39@wincent.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Adam Megacz","fromEmail":"adam@megacz.com","sentAt":"2010-01-16T02:56:21Z","receivedAt":"2010-01-16T02:56:21Z","isPatch":true,"sender":{"key":"adam@megacz.com","avatar":null},"body":"\nWincent Colaiuta <win@wincent.com> writes:\n> Fair enough, but I'm sighing here at the thought of people jumping in  \n> and using git commands without even having looked at _any_ of the  \n> zillions of \"your first 10 minutes with Git\" tutorials out there,  \n\nI don't think that's what this thread is really about, although helping\nthose people might be a harmless side-effect.\n\n>> and people who have git configured on another machine but are using\n>> _this_ machine for the first time).\n\nFor the record, this is what I have been burned by several times now.\n\nI'm now stuck with a bunch of repositories I can no longer fix because\ndata blindly yanked out of libnss and never shown to me was then SHA-1\nsigned for all eternity.  It's incredibly frustrating.\n\nThank you for taking steps to save others from this frustration in the\nfuture.  I appreciate it.\n\n  - a\n"},{"id":"131927","messageId":"7vhbql85ti.fsf@alter.siamese.dyndns.org","threadId":"22095","inReplyTo":"20100113173951.GC16786@coredump.intra.peff.net","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-17T08:59:53Z","receivedAt":"2010-01-17T08:59:53Z","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> @@ -1046,9 +1058,12 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n>  {\n>  \tstruct rev_info rev;\n>  \tstruct commit *commit;\n> -\tstatic const char *format = \"format:%h] %s\";\n> +\tstruct strbuf format = STRBUF_INIT;\n>  \tunsigned char junk_sha1[20];\n>  \tconst char *head = resolve_ref(\"HEAD\", junk_sha1, 0, NULL);\n> +\tstruct pretty_print_context pctx = {0};\n> +\tstruct strbuf author_ident = STRBUF_INIT;\n> +\tstruct strbuf committer_ident = STRBUF_INIT;\n>  \n>  \tcommit = lookup_commit(sha1);\n>  \tif (!commit)\n> @@ -1056,6 +1071,23 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n>  \tif (!commit || parse_commit(commit))\n>  \t\tdie(\"could not parse newly created commit\");\n>  \n> +\tstrbuf_addstr(&format, \"format:%h] %s\");\n> + ...\n> +\tif (strbuf_cmp(&author_ident, &committer_ident)) {\n> +\t\tstrbuf_addstr(&format, \"\\n Author: \");\n> +\t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n> +\t}\n> +\tif (!user_ident_explicitly_given) {\n> +\t\tstrbuf_addstr(&format, \"\\n Committer: \");\n> +\t\tstrbuf_addbuf_percentquote(&format, &committer_ident);\n> +\t\tstrbuf_addch(&format, '\\n');\n> +\t\tstrbuf_addstr(&format, implicit_ident_advice);\n> +\t}\n> + ...\n> -\tget_commit_format(format, &rev);\n> +\tget_commit_format(format.buf, &rev);\n> +\tstrbuf_release(&format);\n>  \trev.always_show_header = 0;\n>  \trev.diffopt.detect_rename = 1;\n>  \trev.diffopt.rename_limit = 100;\n\nThis prepares the user format for log_tree_commit(); get_commit_format()\ncopies it away in its userformat, so it appears we are done with format\nstrbuf we built, and we release...\n\n> @@ -1085,7 +1118,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n>  \t\tstruct pretty_print_context ctx = {0};\n>  \t\tstruct strbuf buf = STRBUF_INIT;\n>  \t\tctx.date_mode = DATE_NORMAL;\n> -\t\tformat_commit_message(commit, format + 7, &buf, &ctx);\n> +\t\tformat_commit_message(commit, format.buf + 7, &buf, &ctx);\n>  \t\tprintf(\"%s\\n\", buf.buf);\n\nBut sometimes log_tree_commit() doesn't show the header.  Most notably for\nmerges.  What string are we using for format_commit_message()?  Oops.\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex a73a532..7f61e87 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -1013,7 +1013,6 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \trev.verbose_header = 1;\n \trev.show_root_diff = 1;\n \tget_commit_format(format.buf, &rev);\n-\tstrbuf_release(&format);\n \trev.always_show_header = 0;\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n@@ -1036,6 +1035,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \t\tprintf(\"%s\\n\", buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\n+\tstrbuf_release(&format);\n }\n \n static int git_commit_config(const char *k, const char *v, void *cb)\n"},{"id":"131939","messageId":"vpq6371ufvi.fsf@bauges.imag.fr","threadId":"22095","inReplyTo":"1DDB570B-350A-40A0-B6E4-ADBDF4BE6BD2@wincent.com","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-01-17T11:31:45Z","receivedAt":"2010-01-17T11:31:45Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n\n> I'll never see this message myself, but I think you could (and perhaps\n> should) replace almost all of that with:\n>\n>   Your name and email address were configured automatically.\n>   See \"git config help\" for information on setting them explicitly\n>   or \"git commit help\" if you wish to amend this commit.\n\nI don't think this is a good idea. The two main cases when this\ninformation will be shown is:\n\n* Newbies, who didn't read the doc, or read it too fast. They'll\n  happily ignore your short message.\n\n  For example, I just started a project with 200 students. The doc we\n  give them _starts_ with setting user/email in ~/.gitconfig, right\n  before we give them the URL of the repository they'll work on. Out\n  of that, 22 email adresses were mis-configured. Don't underestimate\n  the ability of newbies not to read doc, even when told to do so.\n\n  If the message is long, it'll be disturbing, and they may end up\n  reading it.\n\n* Non-newbies, using a machine for the first time. These users will\n  see the message once, so it's not really disturbing, and at least I\n  would appreciate the message to be flashy, to make sure I don't miss\n  it.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"131950","messageId":"20100117161830.GA7153@sigill.intra.peff.net","threadId":"22095","inReplyTo":"7vhbql85ti.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] commit: show interesting ident information in summary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-17T16:18:30Z","receivedAt":"2010-01-17T16:18:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 17, 2010 at 12:59:53AM -0800, Junio C Hamano wrote:\n\n> > @@ -1085,7 +1118,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n> >  \t\tstruct pretty_print_context ctx = {0};\n> >  \t\tstruct strbuf buf = STRBUF_INIT;\n> >  \t\tctx.date_mode = DATE_NORMAL;\n> > -\t\tformat_commit_message(commit, format + 7, &buf, &ctx);\n> > +\t\tformat_commit_message(commit, format.buf + 7, &buf, &ctx);\n> >  \t\tprintf(\"%s\\n\", buf.buf);\n> \n> But sometimes log_tree_commit() doesn't show the header.  Most notably for\n> merges.  What string are we using for format_commit_message()?  Oops.\n\nUgh. Thank you and good catch.\n\n-Peff\n"}]}