{"thread":{"id":"30580","subject":"diffstat witdth with one changed file","startedAt":"2012-05-21T15:52:22Z","lastAt":"2012-05-22T16:47:14Z","messageCount":6,"participants":["Nguyen Thai Ngoc Duy","Andreas Schwab","Junio C Hamano","Zbigniew Jędrzejewski-Szmek"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191815","messageId":"CACsJy8BrqaLbtVp5uF3q2Jo63DPwtFACYw3_rPy8eyNK7VSWMw@mail.gmail.com","threadId":"30580","inReplyTo":null,"subject":"diffstat witdth with one changed file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-05-21T15:52:22Z","receivedAt":"2012-05-21T15:52:22Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nWith recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\nuses full terminal width while the next one uses less than 80 chars.\nBoth changes one file. Is it intentional? I tend to think it's a bug\nbecause with one-file changes, diffstat width is not important as we\nhave no other files to compare with.\n-- \nDuy\n"},{"id":"191818","messageId":"m2obphcubh.fsf@igel.home","threadId":"30580","inReplyTo":"CACsJy8BrqaLbtVp5uF3q2Jo63DPwtFACYw3_rPy8eyNK7VSWMw@mail.gmail.com","subject":"Re: diffstat witdth with one changed file","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-05-21T17:33:54Z","receivedAt":"2012-05-21T17:33:54Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> With recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\n> uses full terminal width while the next one uses less than 80 chars.\n> Both changes one file. Is it intentional?\n\nIn commit 0e641b1 the file has only 41 lines of changes, so it looks\nintentional.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"191841","messageId":"7vehqd6urj.fsf@alter.siamese.dyndns.org","threadId":"30580","inReplyTo":"m2obphcubh.fsf@igel.home","subject":"Re: diffstat witdth with one changed file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-21T22:20:48Z","receivedAt":"2012-05-21T22:20:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n>\n>> With recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\n>> uses full terminal width while the next one uses less than 80 chars.\n>> Both changes one file. Is it intentional?\n>\n> In commit 0e641b1 the file has only 41 lines of changes, so it looks\n> intentional.\n\nCorrect.  We do not try to make width of bars from two different commits\ncomparable [*1*], but we do try to make them comparable within a single\ncommit; for a commit that changes only a single path, you still have adds\nand removals to compare.  The overall length is ideally one + or - per\nline if the graph fits the output width, but if that makes the graph too\nwide, we scale to fit in the output width.  So a change with 41 lines gets\nonly 41 +/- and does not consume full 80-column terminal.\n\n[Footnote]\n\n*1* This is very much on purpose; otherwise it will hurt the perceived\nlatency of the command.\n"},{"id":"191880","messageId":"4FBB2B4B.6030402@in.waw.pl","threadId":"30580","inReplyTo":"CACsJy8BrqaLbtVp5uF3q2Jo63DPwtFACYw3_rPy8eyNK7VSWMw@mail.gmail.com","subject":"Re: diffstat witdth with one changed file","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-05-22T05:59:39Z","receivedAt":"2012-05-22T05:59:39Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:\n> Hi,\n> \n> With recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\n> uses full terminal width while the next one uses less than 80 chars.\n> Both changes one file. Is it intentional? I tend to think it's a bug\n> because with one-file changes, diffstat width is not important as we\n> have no other files to compare with.\nHi,\n90e6ef5 makes 502 additions/deletions, so it scales the +- part to the\nwhole available terminal width. 90e6ef5^ does only 41 additions, so it\ncan display the +- part unscaled without even filling the terminal width.\n\nSince we don't coordinate the diffstat width between different commits\nin the same git-log invocation, there's no way to make the diffstats use\nthe same scale. Anyway, diffstat is only supposed to give a rough\noverview, and it does that here.\n\nWhat output would you expect?\n\nZbyszek\n"},{"id":"191893","messageId":"CACsJy8D1eMhyPm8b5D6vSuMDvebfX1hB2GUz82E8LeVhnWsqCQ@mail.gmail.com","threadId":"30580","inReplyTo":"4FBB2B4B.6030402@in.waw.pl","subject":"Re: diffstat witdth with one changed file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-05-22T12:50:59Z","receivedAt":"2012-05-22T12:50:59Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, May 22, 2012 at 12:59 PM, Zbigniew Jędrzejewski-Szmek\n<zbyszek@in.waw.pl> wrote:\n> On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:\n>> Hi,\n>>\n>> With recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\n>> uses full terminal width while the next one uses less than 80 chars.\n>> Both changes one file. Is it intentional? I tend to think it's a bug\n>> because with one-file changes, diffstat width is not important as we\n>> have no other files to compare with.\n> Hi,\n> 90e6ef5 makes 502 additions/deletions, so it scales the +- part to the\n> whole available terminal width. 90e6ef5^ does only 41 additions, so it\n> can display the +- part unscaled without even filling the terminal width.\n>\n> Since we don't coordinate the diffstat width between different commits\n> in the same git-log invocation, there's no way to make the diffstats use\n> the same scale. Anyway, diffstat is only supposed to give a rough\n> overview, and it does that here.\n\nYeah, others have explained it. And it makes sense.\n\n> What output would you expect?\n\nIt just looks weird that while most of the commits fill half of my\nscreen (200 char width), some diffstats strike a line through the\nright edge. And I did not see the reason for that in the beginning\nbecause I thought long lines only makes sense when compare to other\nlines.\n-- \nDuy\n"},{"id":"191901","messageId":"4FBBC312.5000402@in.waw.pl","threadId":"30580","inReplyTo":"CACsJy8D1eMhyPm8b5D6vSuMDvebfX1hB2GUz82E8LeVhnWsqCQ@mail.gmail.com","subject":"Re: diffstat witdth with one changed file","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-05-22T16:47:14Z","receivedAt":"2012-05-22T16:47:14Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 05/22/2012 02:50 PM, Nguyen Thai Ngoc Duy wrote:\n>> On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:\n>>> Hi,\n>>>\n>>> With recent git, \"git log --stat 90e6ef5\", the first commit's diffstat\n>>> uses full terminal width while the next one uses less than 80 chars.\n>>> Both changes one file. Is it intentional? I tend to think it's a bug\n>>> because with one-file changes, diffstat width is not important as we\n>>> have no other files to compare with.\n> It just looks weird that while most of the commits fill half of my\n> screen (200 char width), some diffstats strike a line through the\n> right edge. And I did not see the reason for that in the beginning\n> because I thought long lines only makes sense when compare to other\n> lines.\n\nA side note: 'git diff --stat-graph-width=N' or 'git config\ndiff.statGraphWidth N' can be used to limit the width of the graph part.\nI don't use it myself, but it could be useful if you have a really wide\nterminal.\n\nZbyszek\n"}]}