{"thread":{"id":"17772","subject":"[PATCH] log: make --abbrev-commit's ellipsis configurable","startedAt":"2009-02-13T12:58:40Z","lastAt":"2009-02-13T22:24:50Z","messageCount":11,"participants":["Thomas Rast","Johannes Schindelin","Johannes Sixt","Jakub Narebski","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104513","messageId":"1234529920-9694-1-git-send-email-trast@student.ethz.ch","threadId":"17772","inReplyTo":null,"subject":"[PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-13T12:58:40Z","receivedAt":"2009-02-13T12:58:40Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"'git log --abbrev-commit' adds an ellipsis to all commit names that\nwere abbreviated.  This is annoying if you want to cut&paste the sha1\nfrom the terminal, since selecting by word will pick up '...' too.\n(And this cannot be fixed by making '.' a non-word character; in other\ninstances, such as the '123457..abcdef0' from git-fetch, it's part of\nthe expression.)\n\nSo we introduce a new variable format.abbrevEllipsis that defaults to\ntrue (previous behaviour).  If disabled, the formatting routines for\nlog/show/whatchanged do not append an ellipsis.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nAsked for by dato (Adeodato SimÃ³) on IRC.  The bad interaction with\nword selection always bothered me, so I jumped at the opportunity.\n\nBTW, how strict is the alphabetic order of Documentation/config.txt\nsupposed to be?  I noticed several options are in the wrong place,\ne.g., format.headers, format.suffix, pack.indexVersion, and\ncore.autocrlf.\n\n\n Documentation/config.txt |    6 ++++++\n builtin-log.c            |    4 ++++\n log-tree.c               |   19 ++++++++++++++-----\n log-tree.h               |    3 +++\n pretty.c                 |    6 ++----\n t/t4202-log.sh           |   23 +++++++++++++++++++++++\n 6 files changed, 52 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 1806a60..ee5b76f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -656,6 +656,12 @@ fetch.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n+format.abbrevEllipsis::\n+\tWhether --abbrev-commit for log/show/whatchanged should append\n+\tan ellipsis (...) to the abbreviated SHA-1.  Defaults to true.\n+\tSee linkgit:git-log[1], linkgit:git-show[1],\n+\tlinkgit:git-whatchanged[1].\n+\n format.numbered::\n \tA boolean which can enable or disable sequence numbers in patch\n \tsubjects.  It defaults to \"auto\" which enables it only if there\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 2ae39af..f85e469 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -227,6 +227,10 @@ static int git_log_config(const char *var, const char *value, void *cb)\n \t\tdefault_show_root = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.abbrevellipsis\")) {\n+\t\tlog_abbrev_commit_ellipsis = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n \treturn git_diff_ui_config(var, value, cb);\n }\n \ndiff --git a/log-tree.c b/log-tree.c\nindex 194ddb1..ec7d3e4 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -8,6 +8,7 @@\n #include \"refs.h\"\n \n struct decoration name_decoration = { \"object names\" };\n+int log_abbrev_commit_ellipsis = 1;\n \n static void add_name_decoration(const char *prefix, const char *name, struct object *obj)\n {\n@@ -43,12 +44,20 @@ void load_ref_decorations(void)\n \t}\n }\n \n+const char *log_unique_abbrev(const unsigned char *sha1, int abbrev)\n+{\n+\tif (log_abbrev_commit_ellipsis)\n+\t\treturn diff_unique_abbrev(sha1, abbrev);\n+\telse\n+\t\treturn find_unique_abbrev(sha1, abbrev);\n+}\n+\n static void show_parents(struct commit *commit, int abbrev)\n {\n \tstruct commit_list *p;\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n-\t\tprintf(\" %s\", diff_unique_abbrev(parent->object.sha1, abbrev));\n+\t\tprintf(\" %s\", log_unique_abbrev(parent->object.sha1, abbrev));\n \t}\n }\n \n@@ -280,7 +289,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n+\t\tfputs(log_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tshow_decorations(opt, commit);\n@@ -348,14 +357,14 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n+\t\tfputs(log_unique_abbrev(commit->object.sha1, abbrev_commit),\n \t\t      stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tprintf(\" (from %s)\",\n-\t\t\t       diff_unique_abbrev(parent->object.sha1,\n-\t\t\t\t\t\t  abbrev_commit));\n+\t\t\t       log_unique_abbrev(parent->object.sha1,\n+\t\t\t\t\t\t abbrev_commit));\n \t\tshow_decorations(opt, commit);\n \t\tprintf(\"%s\", diff_get_color_opt(&opt->diffopt, DIFF_RESET));\n \t\tif (opt->commit_format == CMIT_FMT_ONELINE) {\ndiff --git a/log-tree.h b/log-tree.h\nindex f2a9008..af99c69 100644\n--- a/log-tree.h\n+++ b/log-tree.h\n@@ -3,6 +3,8 @@\n \n #include \"revision.h\"\n \n+extern int log_abbrev_commit_ellipsis;\n+\n struct log_info {\n \tstruct commit *commit, *parent;\n };\n@@ -18,5 +20,6 @@ void log_write_email_headers(struct rev_info *opt, const char *name,\n \t\t\t     const char **extra_headers_p,\n \t\t\t     int *need_8bit_cte_p);\n void load_ref_decorations(void);\n+const char *log_unique_abbrev(const unsigned char *sha1, int abbrev);\n \n #endif\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..c64ad23 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -210,15 +210,13 @@ static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,\n \twhile (parent) {\n \t\tstruct commit *p = parent->item;\n \t\tconst char *hex = NULL;\n-\t\tconst char *dots;\n \t\tif (abbrev)\n-\t\t\thex = find_unique_abbrev(p->object.sha1, abbrev);\n+\t\t\thex = log_unique_abbrev(p->object.sha1, abbrev);\n \t\tif (!hex)\n \t\t\thex = sha1_to_hex(p->object.sha1);\n-\t\tdots = (abbrev && strlen(hex) != 40) ?  \"...\" : \"\";\n \t\tparent = parent->next;\n \n-\t\tstrbuf_addf(sb, \" %s%s\", hex, dots);\n+\t\tstrbuf_addf(sb, \" %s\", hex);\n \t}\n \tstrbuf_addch(sb, '\\n');\n }\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 7b976ee..730036e 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -134,5 +134,28 @@ test_expect_success 'log --grep -i' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'git log --abbrev-commit (default: ellipsis enabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1)\\\\.\\\\.\\\\.\"\n+'\n+\n+test_expect_success 'enable format.abbrevEllipsis' '\n+\tgit config format.abbrevEllipsis true\n+'\n+\n+test_expect_success 'git log --abbrev-commit (ellipsis enabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1)\\\\.\\\\.\\\\.\"\n+'\n+\n+test_expect_success 'disable format.abbrevEllipsis' '\n+\tgit config format.abbrevEllipsis false\n+'\n+\n+test_expect_success 'git log --abbrev-commit (ellipsis disabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1) \"\n+'\n+\n test_done\n \n-- \n1.6.2.rc0.274.g97213\n"},{"id":"104514","messageId":"alpine.DEB.1.00.0902131418230.10279@pacific.mpi-cbg.de","threadId":"17772","inReplyTo":"1234529920-9694-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-13T13:20:58Z","receivedAt":"2009-02-13T13:20:58Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 13 Feb 2009, Thomas Rast wrote:\n\n> 'git log --abbrev-commit' adds an ellipsis to all commit names that\n> were abbreviated.  This is annoying if you want to cut&paste the sha1\n> from the terminal, since selecting by word will pick up '...' too.\n> (And this cannot be fixed by making '.' a non-word character; in other\n> instances, such as the '123457..abcdef0' from git-fetch, it's part of\n> the expression.)\n> \n> So we introduce a new variable format.abbrevEllipsis that defaults to\n> true (previous behaviour).  If disabled, the formatting routines for\n> log/show/whatchanged do not append an ellipsis.\n> \n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n> ---\n>[...]\n>\n>  Documentation/config.txt |    6 ++++++\n>  builtin-log.c            |    4 ++++\n>  log-tree.c               |   19 ++++++++++++++-----\n>  log-tree.h               |    3 +++\n>  pretty.c                 |    6 ++----\n\nI am slightly worried that you overshoot here, as log-tree.c has plumbing \nusers, too, no?\n\nHow about making this an option, and passing it in rev_opts instead?  This \noption could then be defaulted to in git-log, when the user said \n--abbrev-commit.\n\nCiao,\nDscho\n"},{"id":"104515","messageId":"200902131437.49293.trast@student.ethz.ch","threadId":"17772","inReplyTo":"alpine.DEB.1.00.0902131418230.10279@pacific.mpi-cbg.de","subject":"Re: [PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-13T13:37:39Z","receivedAt":"2009-02-13T13:37:39Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Johannes Schindelin wrote:\n> On Fri, 13 Feb 2009, Thomas Rast wrote:\n[...]\n> >  log-tree.c               |   19 ++++++++++++++-----\n> >  log-tree.h               |    3 +++\n> \n> I am slightly worried that you overshoot here, as log-tree.c has plumbing \n> users, too, no?\n> \n> How about making this an option, and passing it in rev_opts instead?  This \n> option could then be defaulted to in git-log, when the user said \n> --abbrev-commit.\n\nBut the 'git_config(git_log_config, NULL);' that sets the new variable\nto false is only called from cmd_{log,show,whatchanged,reflog}.  I\nshould have indicated this in the commit messaged, sorry.\n\nThe real problem with stuffing it in rev_opts (actually rev_info :-)\nis that it seems inconsistent to not change the 'Merge: blah' line's\nformat.  But that is generated in pretty.c, in add_merge_info via\npp_header from pretty_print_commit, which has a bunch of users in\nvarious 'builtin-*.c'.\n\nSo do I sacrifice symmetry (abbrev_commit is indeed stored in\nrev_info), or touch the other ~7 users of pretty_print_commit too?\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"104516","messageId":"alpine.DEB.1.00.0902131445390.10279@pacific.mpi-cbg.de","threadId":"17772","inReplyTo":"200902131437.49293.trast@student.ethz.ch","subject":"Re: [PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-13T13:47:36Z","receivedAt":"2009-02-13T13:47:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 13 Feb 2009, Thomas Rast wrote:\n\n> Johannes Schindelin wrote:\n> > On Fri, 13 Feb 2009, Thomas Rast wrote:\n> [...]\n> > >  log-tree.c               |   19 ++++++++++++++-----\n> > >  log-tree.h               |    3 +++\n> > \n> > I am slightly worried that you overshoot here, as log-tree.c has plumbing \n> > users, too, no?\n> > \n> > How about making this an option, and passing it in rev_opts instead?  This \n> > option could then be defaulted to in git-log, when the user said \n> > --abbrev-commit.\n> \n> But the 'git_config(git_log_config, NULL);' that sets the new variable\n> to false is only called from cmd_{log,show,whatchanged,reflog}.  I\n> should have indicated this in the commit messaged, sorry.\n> \n> The real problem with stuffing it in rev_opts (actually rev_info :-)\n> is that it seems inconsistent to not change the 'Merge: blah' line's\n> format.  But that is generated in pretty.c, in add_merge_info via\n> pp_header from pretty_print_commit, which has a bunch of users in\n> various 'builtin-*.c'.\n> \n> So do I sacrifice symmetry (abbrev_commit is indeed stored in\n> rev_info), or touch the other ~7 users of pretty_print_commit too?\n\nThanks, I understand much better now.\n\nHmm... I cannot really make my mind up what I prefer.  But you have \nimplemented one of the two options, so...\n\nCiao,\nDscho\n"},{"id":"104518","messageId":"1234535092-20133-1-git-send-email-trast@student.ethz.ch","threadId":"17772","inReplyTo":"alpine.DEB.1.00.0902131445390.10279@pacific.mpi-cbg.de","subject":"[PATCH v2] log: make --abbrev-commit's ellipsis configurable","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-13T14:24:52Z","receivedAt":"2009-02-13T14:24:52Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"'git log --abbrev-commit' adds an ellipsis to all commit names that\nwere abbreviated.  This is annoying if you want to cut&paste the sha1\nfrom the terminal, since selecting by word will pick up '...' too.\n(And this cannot be fixed by making '.' a non-word character; in other\ninstances, such as the '123457..abcdef0' from git-fetch, it's part of\nthe expression.)\n\nSo we introduce a new variable format.abbrevEllipsis that defaults to\ntrue (previous behaviour).  If disabled, the formatting routines for\nlog/show/whatchanged do not append an ellipsis.\n\nInternally we use a new global variable that is only set to false in\ngit_log_config, which is only called from log, show, whatchanged and\nreflog, thus not affecting plumbing.  For symmetry with abbrev_commit,\nit should go in rev_info, but that way we could not reach the\nformatting in add_merge_info() without touching all calls of\npretty_print_commit().\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nChanged the commit message to reflect the discussion in this thread.\n\n\n Documentation/config.txt |    6 ++++++\n builtin-log.c            |    4 ++++\n log-tree.c               |   19 ++++++++++++++-----\n log-tree.h               |    3 +++\n pretty.c                 |    6 ++----\n t/t4202-log.sh           |   23 +++++++++++++++++++++++\n 6 files changed, 52 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 1806a60..ee5b76f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -656,6 +656,12 @@ fetch.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n+format.abbrevEllipsis::\n+\tWhether --abbrev-commit for log/show/whatchanged should append\n+\tan ellipsis (...) to the abbreviated SHA-1.  Defaults to true.\n+\tSee linkgit:git-log[1], linkgit:git-show[1],\n+\tlinkgit:git-whatchanged[1].\n+\n format.numbered::\n \tA boolean which can enable or disable sequence numbers in patch\n \tsubjects.  It defaults to \"auto\" which enables it only if there\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 2ae39af..f85e469 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -227,6 +227,10 @@ static int git_log_config(const char *var, const char *value, void *cb)\n \t\tdefault_show_root = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.abbrevellipsis\")) {\n+\t\tlog_abbrev_commit_ellipsis = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n \treturn git_diff_ui_config(var, value, cb);\n }\n \ndiff --git a/log-tree.c b/log-tree.c\nindex 194ddb1..ec7d3e4 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -8,6 +8,7 @@\n #include \"refs.h\"\n \n struct decoration name_decoration = { \"object names\" };\n+int log_abbrev_commit_ellipsis = 1;\n \n static void add_name_decoration(const char *prefix, const char *name, struct object *obj)\n {\n@@ -43,12 +44,20 @@ void load_ref_decorations(void)\n \t}\n }\n \n+const char *log_unique_abbrev(const unsigned char *sha1, int abbrev)\n+{\n+\tif (log_abbrev_commit_ellipsis)\n+\t\treturn diff_unique_abbrev(sha1, abbrev);\n+\telse\n+\t\treturn find_unique_abbrev(sha1, abbrev);\n+}\n+\n static void show_parents(struct commit *commit, int abbrev)\n {\n \tstruct commit_list *p;\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n-\t\tprintf(\" %s\", diff_unique_abbrev(parent->object.sha1, abbrev));\n+\t\tprintf(\" %s\", log_unique_abbrev(parent->object.sha1, abbrev));\n \t}\n }\n \n@@ -280,7 +289,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n+\t\tfputs(log_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tshow_decorations(opt, commit);\n@@ -348,14 +357,14 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n+\t\tfputs(log_unique_abbrev(commit->object.sha1, abbrev_commit),\n \t\t      stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tprintf(\" (from %s)\",\n-\t\t\t       diff_unique_abbrev(parent->object.sha1,\n-\t\t\t\t\t\t  abbrev_commit));\n+\t\t\t       log_unique_abbrev(parent->object.sha1,\n+\t\t\t\t\t\t abbrev_commit));\n \t\tshow_decorations(opt, commit);\n \t\tprintf(\"%s\", diff_get_color_opt(&opt->diffopt, DIFF_RESET));\n \t\tif (opt->commit_format == CMIT_FMT_ONELINE) {\ndiff --git a/log-tree.h b/log-tree.h\nindex f2a9008..af99c69 100644\n--- a/log-tree.h\n+++ b/log-tree.h\n@@ -3,6 +3,8 @@\n \n #include \"revision.h\"\n \n+extern int log_abbrev_commit_ellipsis;\n+\n struct log_info {\n \tstruct commit *commit, *parent;\n };\n@@ -18,5 +20,6 @@ void log_write_email_headers(struct rev_info *opt, const char *name,\n \t\t\t     const char **extra_headers_p,\n \t\t\t     int *need_8bit_cte_p);\n void load_ref_decorations(void);\n+const char *log_unique_abbrev(const unsigned char *sha1, int abbrev);\n \n #endif\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..c64ad23 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -210,15 +210,13 @@ static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,\n \twhile (parent) {\n \t\tstruct commit *p = parent->item;\n \t\tconst char *hex = NULL;\n-\t\tconst char *dots;\n \t\tif (abbrev)\n-\t\t\thex = find_unique_abbrev(p->object.sha1, abbrev);\n+\t\t\thex = log_unique_abbrev(p->object.sha1, abbrev);\n \t\tif (!hex)\n \t\t\thex = sha1_to_hex(p->object.sha1);\n-\t\tdots = (abbrev && strlen(hex) != 40) ?  \"...\" : \"\";\n \t\tparent = parent->next;\n \n-\t\tstrbuf_addf(sb, \" %s%s\", hex, dots);\n+\t\tstrbuf_addf(sb, \" %s\", hex);\n \t}\n \tstrbuf_addch(sb, '\\n');\n }\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 7b976ee..730036e 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -134,5 +134,28 @@ test_expect_success 'log --grep -i' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'git log --abbrev-commit (default: ellipsis enabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1)\\\\.\\\\.\\\\.\"\n+'\n+\n+test_expect_success 'enable format.abbrevEllipsis' '\n+\tgit config format.abbrevEllipsis true\n+'\n+\n+test_expect_success 'git log --abbrev-commit (ellipsis enabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1)\\\\.\\\\.\\\\.\"\n+'\n+\n+test_expect_success 'disable format.abbrevEllipsis' '\n+\tgit config format.abbrevEllipsis false\n+'\n+\n+test_expect_success 'git log --abbrev-commit (ellipsis disabled)' '\n+\tgit log --pretty=oneline --abbrev-commit -1 |\n+\tgrep \"^$(git log --pretty=format:%h -1) \"\n+'\n+\n test_done\n \n-- \n1.6.2.rc0.274.g97213\n"},{"id":"104522","messageId":"4995928A.5000908@viscovery.net","threadId":"17772","inReplyTo":"1234535092-20133-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH v2] log: make --abbrev-commit's ellipsis configurable","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-13T15:32:26Z","receivedAt":"2009-02-13T15:32:26Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Thomas Rast schrieb:\n> So we introduce a new variable format.abbrevEllipsis that defaults to\n> true (previous behaviour).\n\nHow about format.hideAbbrevDots that defaults to false? Then you can write\nin the config file:\n\n    [format]\n         hideAbbrevDots\n\n(note: without '= true').\n\nEven though I usually detest double negations (and I would count\nhideAbbrevDots=false as one), the ability to set the non-default value of\na Boolean variable in this way trumps my taste.\n\n-- Hannes\n"},{"id":"104527","messageId":"8fe92b430902130845r4ebe32eq78f849d66ab899fa@mail.gmail.com","threadId":"17772","inReplyTo":"m363jeux00.fsf@localhost.localdomain","subject":"Re: [PATCH v2] log: make --abbrev-commit's ellipsis configurable","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-02-13T16:45:01Z","receivedAt":"2009-02-13T16:45:01Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n> Thomas Rast schrieb:\n\n> > So we introduce a new variable format.abbrevEllipsis that defaults to\n> > true (previous behaviour).\n>\n> How about format.hideAbbrevDots that defaults to false? Then you can write\n> in the config file:\n>\n>     [format]\n>          hideAbbrevDots\n>\n> (note: without '= true').\n>\n> Even though I usually detest double negations (and I would count\n> hideAbbrevDots=false as one), the ability to set the non-default value of\n> a Boolean variable in this way trumps my taste.\n\nBy the way, should it be in [format] section? I thought that format.*\nvariables are about git-format-patch... Wouldn't it be better to put it\nin [log] section?\n\nOn the other hand we have already format.pretty (but log.date and\nlog.showroot).  Nice consistency ;-(\n\n\n--\nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"104541","messageId":"20090213192724.GA6782@coredump.intra.peff.net","threadId":"17772","inReplyTo":"200902131437.49293.trast@student.ethz.ch","subject":"Re: [PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-13T19:27:24Z","receivedAt":"2009-02-13T19:27:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 13, 2009 at 02:37:39PM +0100, Thomas Rast wrote:\n\n> > How about making this an option, and passing it in rev_opts instead?  This \n> > option could then be defaulted to in git-log, when the user said \n> > --abbrev-commit.\n> \n> But the 'git_config(git_log_config, NULL);' that sets the new variable\n> to false is only called from cmd_{log,show,whatchanged,reflog}.  I\n> should have indicated this in the commit messaged, sorry.\n\nWe use that technique elsewhere in git, and personally I am not a fan of\nit, as it comes down to setting a global variable. That worked fine when\nwe had a lot of one-shot programs that read the config, did a defined\npiece of work, and then exited.\n\nBut more and more we are performing multiple actions in a single run\n(especially as many scripts become builtin porcelains), and those\nglobals are applied to all actions. So a porcelain trying to do a\nplumbing-ish thing can run into problems.\n\nI can't recall the exact details, but I remember dealing with something\nlike this related to external diff. Using an ALLOW_EXTERNAL diffopt\nended up being more reliable, _and_ easier to read and follow in the\ncode.\n\nNow I don't think this is probably a big problem for this particular\noption, but I'd rather not see the technique propagated.\n\n-Peff\n"},{"id":"104543","messageId":"7vprhm81kk.fsf@gitster.siamese.dyndns.org","threadId":"17772","inReplyTo":"1234529920-9694-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH] log: make --abbrev-commit's ellipsis configurable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-13T21:32:59Z","receivedAt":"2009-02-13T21:32:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> 'git log --abbrev-commit' adds an ellipsis to all commit names that\n> were abbreviated.  This is annoying if you want to cut&paste the sha1\n> from the terminal, since selecting by word will pick up '...' too.\n> (And this cannot be fixed by making '.' a non-word character; in other\n> instances, such as the '123457..abcdef0' from git-fetch, it's part of\n> the expression.)\n\nI actually think that it is a bug that --abbrev-commit uses ellipses.\n\nIt has been there since \"diff --abbrev\" was first introduced by commit\n47dd0d5 (diff: --abbrev option, 2005-12-13).  It did make sense to align\ncolumns in abbreviated raw diff output with ellipses, but it did not make\nmuch sense to do that for commit object names.\n\nSome scripts might be relying on the presense of ellipses but depending on\nthe object distribution, the length of the ellipses can range from zero to\nthree; if they are expecting to always see three dots, such scripts are\nalready broken.\n\nFor this reason, I do not think it is necessarily a bad idea to make this\nchange even unconditionally to both plumbing and Porcelain.\n"},{"id":"104546","messageId":"1234563041-25061-1-git-send-email-trast@student.ethz.ch","threadId":"17772","inReplyTo":"7vprhm81kk.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] log: do not print ellipses with --abbrev-commit","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-13T22:10:41Z","receivedAt":"2009-02-13T22:10:41Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"'git log --abbrev-commit' added an ellipsis to all commit names that\nwere abbreviated.  This was particularly annoying if you wanted to\ncut&paste the sha1 from the terminal, since selecting by word would\npick up '...'  too.\n\nSo use find_unique_abbrev() instead of diff_unique_abbrev() in all\nlog-related commit sha1 printing routines, and also change the\nformatting of the 'Merge: parent1 parent2' line output via\npretty_print_commit().\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nJunio C Hamano wrote:\n> Thomas Rast <trast@student.ethz.ch> writes:\n> > 'git log --abbrev-commit' adds an ellipsis to all commit names that\n[...]\n> I actually think that it is a bug that --abbrev-commit uses ellipses.\n> \n> It has been there since \"diff --abbrev\" was first introduced by commit\n> 47dd0d5 (diff: --abbrev option, 2005-12-13).  It did make sense to align\n> columns in abbreviated raw diff output with ellipses, but it did not make\n> much sense to do that for commit object names.\n\nHeh.  I was actually more careful (making it customizable) because I\nwas afraid it would get shot down because people are used to the other\nformat.  It arguably does make a bit of sense for --pretty=oneline\n(and to some extent --graph --pretty=oneline), though for me the\ndoubleclick word selection by far outweighs the slight chance of\nbreaking the layout because of a longer unique sha1.\n\n> For this reason, I do not think it is necessarily a bad idea to make this\n> change even unconditionally to both plumbing and Porcelain.\n\nThat makes for a smaller change, but affects t4013, where a lot of the\ntests contain a 'Merge:' line.\n\n\n log-tree.c                                         |    8 ++++----\n pretty.c                                           |    4 +---\n ....log_--patch-with-stat_--summary_master_--_dir_ |    2 +-\n t/t4013/diff.log_--patch-with-stat_master          |    2 +-\n t/t4013/diff.log_--patch-with-stat_master_--_dir_  |    2 +-\n ..._--root_--cc_--patch-with-stat_--summary_master |    2 +-\n ...f.log_--root_--patch-with-stat_--summary_master |    2 +-\n t/t4013/diff.log_--root_--patch-with-stat_master   |    2 +-\n ...og_--root_-c_--patch-with-stat_--summary_master |    2 +-\n t/t4013/diff.log_--root_-p_master                  |    2 +-\n t/t4013/diff.log_--root_master                     |    2 +-\n t/t4013/diff.log_-p_master                         |    2 +-\n t/t4013/diff.log_master                            |    2 +-\n t/t4013/diff.show_master                           |    2 +-\n ..._--root_--cc_--patch-with-stat_--summary_master |    2 +-\n ...ed_--root_-c_--patch-with-stat_--summary_master |    2 +-\n 16 files changed, 19 insertions(+), 21 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 194ddb1..84a74e5 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -48,7 +48,7 @@ static void show_parents(struct commit *commit, int abbrev)\n \tstruct commit_list *p;\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n-\t\tprintf(\" %s\", diff_unique_abbrev(parent->object.sha1, abbrev));\n+\t\tprintf(\" %s\", find_unique_abbrev(parent->object.sha1, abbrev));\n \t}\n }\n \n@@ -280,7 +280,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n+\t\tfputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tshow_decorations(opt, commit);\n@@ -348,13 +348,13 @@ void show_log(struct rev_info *opt)\n \t\t\t\t\tputchar('>');\n \t\t\t}\n \t\t}\n-\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n+\t\tfputs(find_unique_abbrev(commit->object.sha1, abbrev_commit),\n \t\t      stdout);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tprintf(\" (from %s)\",\n-\t\t\t       diff_unique_abbrev(parent->object.sha1,\n+\t\t\t       find_unique_abbrev(parent->object.sha1,\n \t\t\t\t\t\t  abbrev_commit));\n \t\tshow_decorations(opt, commit);\n \t\tprintf(\"%s\", diff_get_color_opt(&opt->diffopt, DIFF_RESET));\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..428fbb6 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -210,15 +210,13 @@ static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,\n \twhile (parent) {\n \t\tstruct commit *p = parent->item;\n \t\tconst char *hex = NULL;\n-\t\tconst char *dots;\n \t\tif (abbrev)\n \t\t\thex = find_unique_abbrev(p->object.sha1, abbrev);\n \t\tif (!hex)\n \t\t\thex = sha1_to_hex(p->object.sha1);\n-\t\tdots = (abbrev && strlen(hex) != 40) ?  \"...\" : \"\";\n \t\tparent = parent->next;\n \n-\t\tstrbuf_addf(sb, \" %s%s\", hex, dots);\n+\t\tstrbuf_addf(sb, \" %s\", hex);\n \t}\n \tstrbuf_addch(sb, '\\n');\n }\ndiff --git a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\nindex 3ceb8e7..bd7f5c0 100644\n--- a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n+++ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n@@ -1,6 +1,6 @@\n $ git log --patch-with-stat --summary master -- dir/\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--patch-with-stat_master b/t/t4013/diff.log_--patch-with-stat_master\nindex 43d7776..14595a6 100644\n--- a/t/t4013/diff.log_--patch-with-stat_master\n+++ b/t/t4013/diff.log_--patch-with-stat_master\n@@ -1,6 +1,6 @@\n $ git log --patch-with-stat master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--patch-with-stat_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_\nindex 5187a26..5a4e727 100644\n--- a/t/t4013/diff.log_--patch-with-stat_master_--_dir_\n+++ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_\n@@ -1,6 +1,6 @@\n $ git log --patch-with-stat master -- dir/\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\nindex c964097..df0aaa9 100644\n--- a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git log --root --cc --patch-with-stat --summary master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\nindex ad050af..c11b5f2 100644\n--- a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git log --root --patch-with-stat --summary master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_--patch-with-stat_master b/t/t4013/diff.log_--root_--patch-with-stat_master\nindex 628c6c0..5f0c98f 100644\n--- a/t/t4013/diff.log_--root_--patch-with-stat_master\n+++ b/t/t4013/diff.log_--root_--patch-with-stat_master\n@@ -1,6 +1,6 @@\n $ git log --root --patch-with-stat master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\nindex 5d4e0f1..e62c368 100644\n--- a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git log --root -c --patch-with-stat --summary master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_-p_master b/t/t4013/diff.log_--root_-p_master\nindex 217a2eb..b42c334 100644\n--- a/t/t4013/diff.log_--root_-p_master\n+++ b/t/t4013/diff.log_--root_-p_master\n@@ -1,6 +1,6 @@\n $ git log --root -p master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_--root_master b/t/t4013/diff.log_--root_master\nindex e17ccfc..e8f4615 100644\n--- a/t/t4013/diff.log_--root_master\n+++ b/t/t4013/diff.log_--root_master\n@@ -1,6 +1,6 @@\n $ git log --root master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_-p_master b/t/t4013/diff.log_-p_master\nindex f8fefef..bf1326d 100644\n--- a/t/t4013/diff.log_-p_master\n+++ b/t/t4013/diff.log_-p_master\n@@ -1,6 +1,6 @@\n $ git log -p master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.log_master b/t/t4013/diff.log_master\nindex e9d9e7b..a8f6ce5 100644\n--- a/t/t4013/diff.log_master\n+++ b/t/t4013/diff.log_master\n@@ -1,6 +1,6 @@\n $ git log master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.show_master b/t/t4013/diff.show_master\nindex 9e6e1f2..fb08ce0 100644\n--- a/t/t4013/diff.show_master\n+++ b/t/t4013/diff.show_master\n@@ -1,6 +1,6 @@\n $ git show master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\nindex 5facf25..e96ff1f 100644\n--- a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git whatchanged --root --cc --patch-with-stat --summary master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \ndiff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\nindex 10f6767..c0aff68 100644\n--- a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git whatchanged --root -c --patch-with-stat --summary master\n commit 59d314ad6f356dd08601a4cd5e530381da3e3c64\n-Merge: 9a6d494... c7a2ab9...\n+Merge: 9a6d494 c7a2ab9\n Author: A U Thor <author@example.com>\n Date:   Mon Jun 26 00:04:00 2006 +0000\n \n-- \n1.6.2.rc0.274.g97213\n"},{"id":"104548","messageId":"20090213222450.GB7424@coredump.intra.peff.net","threadId":"17772","inReplyTo":"1234563041-25061-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH] log: do not print ellipses with --abbrev-commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-13T22:24:50Z","receivedAt":"2009-02-13T22:24:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 13, 2009 at 11:10:41PM +0100, Thomas Rast wrote:\n\n> 'git log --abbrev-commit' added an ellipsis to all commit names that\n> were abbreviated.  This was particularly annoying if you wanted to\n> cut&paste the sha1 from the terminal, since selecting by word would\n> pick up '...'  too.\n> \n> So use find_unique_abbrev() instead of diff_unique_abbrev() in all\n> log-related commit sha1 printing routines, and also change the\n> formatting of the 'Merge: parent1 parent2' line output via\n> pretty_print_commit().\n\nI like this. I have always hated the dots, and even started typing extra\n--pretty=tformat lines to get rid of them. I always just assumed we\ndidn't want to change the output, but I think Junio's reasoning that\nscripts cannot be relying on this is sane.\n\n-Peff\n"}]}