{"thread":{"id":"50809","subject":"[PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","startedAt":"2019-03-23T04:17:43Z","lastAt":"2019-04-01T10:45:06Z","messageCount":10,"participants":["Alex Henrie","Abhisek Ghosh","Junio C Hamano","Ævar Arnfjörð Bjarmason","Rafael Ascensão"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"372295","messageId":"20190323041332.9743-1-alexhenrie24@gmail.com","threadId":"50809","inReplyTo":null,"subject":"[PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2019-03-23T04:13:32Z","receivedAt":"2019-03-23T04:17:43Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"Having --pretty=medium as the default almost always makes the graph too\ndifficult to follow.\n\nSigned-off-by: Alex Henrie <alexhenrie24@gmail.com>\n---\n builtin/log.c          |  5 +++++\n t/t4052-stat-output.sh | 14 +++++++-------\n t/t4202-log.sh         | 14 ++++++++++++++\n 3 files changed, 26 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex ab859f5904..4fca910fee 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -199,6 +199,11 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n \tmemset(&w, 0, sizeof(w));\n \tuserformat_find_requirements(NULL, &w);\n \n+\tif (rev->graph && !fmt_pretty && !rev->pretty_given && !rev->show_signature) {\n+\t\trev->abbrev_commit = 1;\n+\t\trev->commit_format = CMIT_FMT_ONELINE;\n+\t}\n+\n \tif (!rev->show_notes_given && (!rev->pretty_given || w.notes))\n \t\trev->show_notes = 1;\n \tif (rev->show_notes)\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 28c053849a..b44776efe3 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -144,7 +144,7 @@ done <<\\EOF\n ignores expect72 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n respects expect200 show --stat\n-respects expect200 log -1 --stat\n+respects expect200 log -1 --pretty=medium --stat\n EOF\n \n cat >expect40 <<'EOF'\n@@ -172,7 +172,7 @@ done <<\\EOF\n ignores expect72 format-patch -1 --stdout\n respects expect40 diff HEAD^ HEAD --stat\n respects expect40 show --stat\n-respects expect40 log -1 --stat\n+respects expect40 log -1 --pretty=medium --stat\n EOF\n \n cat >expect40 <<'EOF'\n@@ -200,7 +200,7 @@ done <<\\EOF\n ignores expect72 format-patch -1 --stdout\n respects expect40 diff HEAD^ HEAD --stat\n respects expect40 show --stat\n-respects expect40 log -1 --stat\n+respects expect40 log -1 --pretty=medium --stat\n EOF\n \n \n@@ -247,7 +247,7 @@ done <<\\EOF\n format-patch -1 --stdout\n diff HEAD^ HEAD --stat\n show --stat\n-log -1 --stat\n+log -1 --pretty=medium --stat\n EOF\n \n test_expect_success 'preparation for long filename tests' '\n@@ -281,7 +281,7 @@ done <<\\EOF\n format-patch -1 --stdout\n diff HEAD^ HEAD --stat\n show --stat\n-log -1 --stat\n+log -1 --pretty=medium --stat\n EOF\n \n cat >expect72 <<'EOF'\n@@ -315,7 +315,7 @@ done <<\\EOF\n ignores expect72 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n respects expect200 show --stat\n-respects expect200 log -1 --stat\n+respects expect200 log -1 --pretty=medium --stat\n EOF\n \n cat >expect1 <<'EOF'\n@@ -345,7 +345,7 @@ done <<\\EOF\n ignores expect72 format-patch -1 --stdout\n respects expect1 diff HEAD^ HEAD --stat\n respects expect1 show --stat\n-respects expect1 log -1 --stat\n+respects expect1 log -1 --pretty=medium --stat\n EOF\n \n cat >expect <<'EOF'\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 819c24d10e..7cf9f15cec 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -39,6 +39,20 @@ test_expect_success setup '\n \n '\n \n+test_expect_success 'default log format' '\n+\n+\tgit log --pretty=medium > expect &&\n+\tgit log > actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'default log --graph format' '\n+\n+\tgit log --graph --pretty=oneline --abbrev-commit > expect &&\n+\tgit log --graph > actual &&\n+\ttest_cmp expect actual\n+'\n+\n printf \"sixth\\nfifth\\nfourth\\nthird\\nsecond\\ninitial\" > expect\n test_expect_success 'pretty' '\n \n-- \n2.21.0\n\n"},{"id":"372296","messageId":"CAC-Lx1sPihYin0rEF=Z3Aa0_S-wWnVQ8=qiNcw-ErNwqDN5tSA@mail.gmail.com","threadId":"50809","inReplyTo":"20190323041332.9743-1-alexhenrie24@gmail.com","subject":"","fromName":"Abhisek Ghosh","fromEmail":"abg@bluecoppertech.com","sentAt":"2019-03-23T06:03:03Z","receivedAt":"2019-03-23T06:05:47Z","isPatch":false,"sender":{"key":"abg@bluecoppertech.com","avatar":null},"body":"unsubscribe git\n"},{"id":"372361","messageId":"xmqq36ncpgpe.fsf@gitster-ct.c.googlers.com","threadId":"50809","inReplyTo":"20190323041332.9743-1-alexhenrie24@gmail.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-24T13:03:41Z","receivedAt":"2019-03-24T13:03:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> Having --pretty=medium as the default almost always makes the graph too\n> difficult to follow.\n>\n> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>\n> ---\n\nI too thought that \"--graph\" should make \"--oneline\" the default\nback when I originally accepted the patch series that introduced the\n\"--graph\" feature, but with frequent use of \"--graph\" myself, I\nstopped being sure that \"--oneline\" should be the default long time\nago.  I find that the default level of prettiness goes reasonably\nwell with the \"--graph\" option.\n\nThis would be something that needs a long transition period if\nsomebody really wants to force people to adapt to it.  I am not sure\nif the complication is worth it.\n"},{"id":"372375","messageId":"877ecocd5q.fsf@evledraar.gmail.com","threadId":"50809","inReplyTo":"xmqq36ncpgpe.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-03-24T18:58:41Z","receivedAt":"2019-03-24T18:58:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sun, Mar 24 2019, Junio C Hamano wrote:\n\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n>> Having --pretty=medium as the default almost always makes the graph too\n>> difficult to follow.\n>>\n>> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>\n>> ---\n>\n> I too thought that \"--graph\" should make \"--oneline\" the default\n> back when I originally accepted the patch series that introduced the\n> \"--graph\" feature, but with frequent use of \"--graph\" myself, I\n> stopped being sure that \"--oneline\" should be the default long time\n> ago.  I find that the default level of prettiness goes reasonably\n> well with the \"--graph\" option.\n>\n> This would be something that needs a long transition period if\n> somebody really wants to force people to adapt to it.  I am not sure\n> if the complication is worth it.\n\nAside from historical/backcompat concerns I think the current rendering\nmakes sense. One could also argue that e.g. --stat benefits from\n--oneline.\n\nWe shouldn't have unrelated options implying one another, except stuff\nlike \"--compact-summary\" implying \"--stat\" (makes no sense\notherwise...).\n\nI use --graph without --oneline more frequently than not. It gives you a\nglance at how deep in a merge hierarchy some log range is, whereas with\n--oneline you're most involved in the shape of that graph to the\nexclusion of other things.\n\nBut maybe a built-in \"git-graph\" is in order? E.g. one can imagine that\nonce we have a dedicated command for that (similar to range-diff) you\ncould really focus on the UX of that, e.g. going further than --oneline\nand truncating a N+ divergence as \"...and N more..\" or something.\n"},{"id":"372385","messageId":"CAMMLpeQbz5qHyK8e4gZ0zKQ5na+zQCd49GZifKZ_iO-gXrs1Gg@mail.gmail.com","threadId":"50809","inReplyTo":"xmqq36ncpgpe.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2019-03-24T22:37:25Z","receivedAt":"2019-03-24T22:37:40Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Sun, Mar 24, 2019 at 7:03 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n> > Having --pretty=medium as the default almost always makes the graph too\n> > difficult to follow.\n> >\n> > Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>\n> > ---\n>\n> I too thought that \"--graph\" should make \"--oneline\" the default\n> back when I originally accepted the patch series that introduced the\n> \"--graph\" feature, but with frequent use of \"--graph\" myself, I\n> stopped being sure that \"--oneline\" should be the default long time\n> ago.  I find that the default level of prettiness goes reasonably\n> well with the \"--graph\" option.\n>\n> This would be something that needs a long transition period if\n> somebody really wants to force people to adapt to it.  I am not sure\n> if the complication is worth it.\n\nCan we compromise and make --pretty=short the default for --graph?\n\n-Alex\n"},{"id":"372390","messageId":"20190325011717.GA5357@rigel","threadId":"50809","inReplyTo":"CAMMLpeQbz5qHyK8e4gZ0zKQ5na+zQCd49GZifKZ_iO-gXrs1Gg@mail.gmail.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Rafael Ascensão","fromEmail":"rafa.almas@gmail.com","sentAt":"2019-03-25T01:17:17Z","receivedAt":"2019-03-25T01:18:05Z","isPatch":true,"sender":{"key":"rafa.almas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1923789?v=4"},"body":"Hi Alex,\n\nOn Sun, Mar 24, 2019 at 04:37:25PM -0600, Alex Henrie wrote:\n> \n> Can we compromise and make --pretty=short the default for --graph?\n> \n\nI agree that `pretty=medium` is sometimes hard to read and, as of now,\n`pretty=oneline` can be very misleading:\n\n    $ git log --graph --oneline todo~2..todo master~2..master\n\nThis will look like you have a sequence of commits when in fact they are\ncompletely unrelated.\n\nBut If we make the default to 'short' (or anything else), what should be\ndone if the user has `format.pretty=` defined to something? Is `--graph`\nspecial to be allowed to not follow said configuration?\n\nIt's inconsistent itself, and introduces inconsistencies on other things\nlike the configuration above.\n\nIn my opinion, a better alternative could be having a configuration like\nlog.graphFormat, similarly how we have log.graphColors for colors, to\ndetermine which format should be used with --graph.\n\nThis would still require user configuration which may be what you were\ntrying to avoid by proposing the change in default behaviour.\n\nSettling for a compromise feels like giving up on the strengths from both.\n\nCheers,\nRafael Ascensão\n"},{"id":"372395","messageId":"CAMMLpeQGz85ogLgKX6DBMyz0wpRvW9fXCpK87m+JoT9i7hw1Kw@mail.gmail.com","threadId":"50809","inReplyTo":"20190325011717.GA5357@rigel","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2019-03-25T05:10:08Z","receivedAt":"2019-03-25T05:10:23Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Sun, Mar 24, 2019 at 7:18 PM Rafael Ascensão <rafa.almas@gmail.com> wrote:\n>\n> But If we make the default to 'short' (or anything else), what should be\n> done if the user has `format.pretty=` defined to something? Is `--graph`\n> special to be allowed to not follow said configuration?\n>\n> It's inconsistent itself, and introduces inconsistencies on other things\n> like the configuration above.\n>\n> In my opinion, a better alternative could be having a configuration like\n> log.graphFormat, similarly how we have log.graphColors for colors, to\n> determine which format should be used with --graph.\n\nThe way that I wrote the patch, if format.pretty is not defined then\n`git log` will default to one format and `git log --graph` will\ndefault to another. I admit that it is a bit of a hack.\n\nOn Sun, Mar 24, 2019 at 12:58 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> But maybe a built-in \"git-graph\" is in order? E.g. one can imagine that\n> once we have a dedicated command for that (similar to range-diff) you\n> could really focus on the UX of that, e.g. going further than --oneline\n> and truncating a N+ divergence as \"...and N more..\" or something.\n\nI like the idea of a completely separate `git graph` command. This\ncommand would simply be a builtin alias for `git log --abbrev-commit\n--pretty=oneline`, like how `git reflog` is a builtin alias for `git\nlog -g --abbrev-commit --pretty=oneline`. Junio, would you be on board\nwith that?\n\n-Alex\n"},{"id":"372396","messageId":"CAMMLpeStw=qg50nbAkuKRTUTvkAhjw8kvZxxrAmTcfuK4L8cmA@mail.gmail.com","threadId":"50809","inReplyTo":"CAMMLpeQGz85ogLgKX6DBMyz0wpRvW9fXCpK87m+JoT9i7hw1Kw@mail.gmail.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2019-03-25T05:16:45Z","receivedAt":"2019-03-25T05:17:02Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Sun, Mar 24, 2019 at 11:10 PM Alex Henrie <alexhenrie24@gmail.com> wrote:\n>\n> I like the idea of a completely separate `git graph` command. This\n> command would simply be a builtin alias for `git log --abbrev-commit\n> --pretty=oneline`, like how `git reflog` is a builtin alias for `git\n> log -g --abbrev-commit --pretty=oneline`. Junio, would you be on board\n> with that?\n\nSorry, I left off the --graph parameter. You can set up what I'm\nproposing as a personal alias with the following command:\n\ngit config --global alias.graph 'log --graph --abbrev-commit --pretty=oneline'\n\n-Alex\n"},{"id":"372583","messageId":"CAMMLpeS1RyjCu6mKe2-oDzCfXheAdpTiXM28dUfd3TyCuZwUFA@mail.gmail.com","threadId":"50809","inReplyTo":"CACUQV59x-W+fCz_O5EnbZhjZ1CB2NhEQbkR8dAYMizAQGQ2SFA@mail.gmail.com","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2019-03-27T17:49:58Z","receivedAt":"2019-03-27T17:50:14Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Sun, Mar 24, 2019 at 11:27 PM Rafael Ascensão <rafa.almas@gmail.com> wrote:\n>\n> Or just $git log --graph --oneline, since --oneline is a shortcut for the longer --pretty=oneline --abbrev-commit.\n\nThanks for the tip! I didn't know about the --oneline option, but now\nthat I do, I suppose I don't really need an alias.\n\n-Alex\n"},{"id":"372870","messageId":"xmqqpnq6vwb6.fsf@gitster-ct.c.googlers.com","threadId":"50809","inReplyTo":"20190325011717.GA5357@rigel","subject":"Re: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-04-01T10:45:01Z","receivedAt":"2019-04-01T10:45:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rafael Ascensão <rafa.almas@gmail.com> writes:\n\n> I agree that `pretty=medium` is sometimes hard to read and, as of now,\n> `pretty=oneline` can be very misleading:\n>\n>     $ git log --graph --oneline todo~2..todo master~2..master\n>\n> This will look like you have a sequence of commits when in fact they are\n> completely unrelated.\n\nThis is pretty much unrelated to which level of details should be\nthe default, isn't it?\n\nI do agree that --graph should be more intelligent around the root\ncommits when showing two or more unrelated lines of histories.\n\nSomething like [*1*] from discussion in 2013 (not the patch that\nstarted the thread, for reasons stated in the thread, but ideas\noffered as alternative design in the discussion) would be the right\nway to solve it and it would work with all the log formatting\noptions, whether --oneline, --pretty=medium, etc.\n\n[Reference]\n\n\n*1* http://public-inbox.org/git/1382717268-21884-1-git-send-email-milton.soares.filho@gmail.com/\n"}]}