{"thread":{"id":"48855","subject":"git log --shortstat doesn't respect -c (but --stat does)","startedAt":"2018-07-10T19:46:18Z","lastAt":"2018-07-10T20:34:41Z","messageCount":2,"participants":["David Turner","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"352173","messageId":"1531251974.28120.90.camel@novalis.org","threadId":"48855","inReplyTo":null,"subject":"git log --shortstat doesn't respect -c (but --stat does)","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2018-07-10T19:46:14Z","receivedAt":"2018-07-10T19:46:18Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"This seems inconsistent:\n\n$ git log --oneline --stat 91ccfb85176 -c\n91ccfb8517 Merge branch 'sb/diff-color-move'\n\n diff.c                     | 28 +++++++++++++++-------------\n t/t4015-diff-whitespace.sh |  9 +++++++++\n 2 files changed, 24 insertions(+), 13 deletions(-)\nd1114d87c7 Merge branch 'js/rebase-i-final'\n\n sequencer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n...\n\n$ git log --oneline --shortstat 91ccfb85176 -c\n91ccfb8517 Merge branch 'sb/diff-color-move'\n\nd1114d87c7 Merge branch 'js/rebase-i-final'\n\n4339c9f2df Merge branch 'jc/doc-checkout'\n...\n\nEspecially since the manual for log -- shortstat says:\n\n--shortstat\n   Output only the last line of the --stat format containing total\n   number of modified files, as well as number of added and deleted\n   lines.\n\n"},{"id":"352178","messageId":"20180710203438.GB6886@sigill.intra.peff.net","threadId":"48855","inReplyTo":"1531251974.28120.90.camel@novalis.org","subject":"Re: git log --shortstat doesn't respect -c (but --stat does)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-07-10T20:34:38Z","receivedAt":"2018-07-10T20:34:41Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 10, 2018 at 03:46:14PM -0400, David Turner wrote:\n\n> This seems inconsistent:\n> \n> $ git log --oneline --stat 91ccfb85176 -c\n> 91ccfb8517 Merge branch 'sb/diff-color-move'\n> \n>  diff.c                     | 28 +++++++++++++++-------------\n>  t/t4015-diff-whitespace.sh |  9 +++++++++\n>  2 files changed, 24 insertions(+), 13 deletions(-)\n> d1114d87c7 Merge branch 'js/rebase-i-final'\n> \n>  sequencer.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> ...\n> \n> $ git log --oneline --shortstat 91ccfb85176 -c\n> 91ccfb8517 Merge branch 'sb/diff-color-move'\n\nYeah. Definitely a bug.\n\nThe patch below seems to fix it, but:\n\n  - it may need similar treatment around DIRSTAT\n\n  - we should probably have a pre-defined mask for stat formats so it\n    doesn't have to be repeated everywhere\n\nI'm logging off for the day in a bit, but maybe somebody wants to\ninvestigate further?\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 2ef495963f..dc6183958a 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1331,7 +1331,7 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid,\n \t\t * combined diff.\n \t\t */\n \t\tint stat_opt = (output_format &\n-\t\t\t\t(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));\n+\t\t\t\t(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT));\n \t\tif (i == 0 && stat_opt)\n \t\t\topt->output_format = stat_opt;\n \t\telse\n@@ -1459,7 +1459,7 @@ void diff_tree_combined(const struct object_id *oid,\n \t\t * when doing combined diff.\n \t\t */\n \t\tstat_opt = (opt->output_format &\n-\t\t\t\t(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));\n+\t\t\t\t(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT));\n \t\tif (stat_opt) {\n \t\t\tdiffopts.output_format = stat_opt;\n \n@@ -1504,7 +1504,7 @@ void diff_tree_combined(const struct object_id *oid,\n \t\t\tneedsep = 1;\n \t\t}\n \t\telse if (opt->output_format &\n-\t\t\t (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT))\n+\t\t\t (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT))\n \t\t\tneedsep = 1;\n \t\telse if (opt->output_format & DIFF_FORMAT_CALLBACK)\n \t\t\thandle_combined_callback(opt, paths, num_parent, num_paths);\n\n-Peff\n"}]}