git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* git log --shortstat doesn't respect -c (but --stat does)
@ 2018-07-10 19:46 David Turner
  2018-07-10 20:34 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: David Turner @ 2018-07-10 19:46 UTC (permalink / raw)
  To: Git Mailing List

This seems inconsistent:

$ git log --oneline --stat 91ccfb85176 -c
91ccfb8517 Merge branch 'sb/diff-color-move'

 diff.c                     | 28 +++++++++++++++-------------
 t/t4015-diff-whitespace.sh |  9 +++++++++
 2 files changed, 24 insertions(+), 13 deletions(-)
d1114d87c7 Merge branch 'js/rebase-i-final'

 sequencer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
...

$ git log --oneline --shortstat 91ccfb85176 -c
91ccfb8517 Merge branch 'sb/diff-color-move'

d1114d87c7 Merge branch 'js/rebase-i-final'

4339c9f2df Merge branch 'jc/doc-checkout'
...

Especially since the manual for log -- shortstat says:

--shortstat
   Output only the last line of the --stat format containing total
   number of modified files, as well as number of added and deleted
   lines.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git log --shortstat doesn't respect -c (but --stat does)
  2018-07-10 19:46 git log --shortstat doesn't respect -c (but --stat does) David Turner
@ 2018-07-10 20:34 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2018-07-10 20:34 UTC (permalink / raw)
  To: David Turner; +Cc: Git Mailing List

On Tue, Jul 10, 2018 at 03:46:14PM -0400, David Turner wrote:

> This seems inconsistent:
> 
> $ git log --oneline --stat 91ccfb85176 -c
> 91ccfb8517 Merge branch 'sb/diff-color-move'
> 
>  diff.c                     | 28 +++++++++++++++-------------
>  t/t4015-diff-whitespace.sh |  9 +++++++++
>  2 files changed, 24 insertions(+), 13 deletions(-)
> d1114d87c7 Merge branch 'js/rebase-i-final'
> 
>  sequencer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> ...
> 
> $ git log --oneline --shortstat 91ccfb85176 -c
> 91ccfb8517 Merge branch 'sb/diff-color-move'

Yeah. Definitely a bug.

The patch below seems to fix it, but:

  - it may need similar treatment around DIRSTAT

  - we should probably have a pre-defined mask for stat formats so it
    doesn't have to be repeated everywhere

I'm logging off for the day in a bit, but maybe somebody wants to
investigate further?

diff --git a/combine-diff.c b/combine-diff.c
index 2ef495963f..dc6183958a 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1331,7 +1331,7 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid,
 		 * combined diff.
 		 */
 		int stat_opt = (output_format &
-				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));
+				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT));
 		if (i == 0 && stat_opt)
 			opt->output_format = stat_opt;
 		else
@@ -1459,7 +1459,7 @@ void diff_tree_combined(const struct object_id *oid,
 		 * when doing combined diff.
 		 */
 		stat_opt = (opt->output_format &
-				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));
+				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT));
 		if (stat_opt) {
 			diffopts.output_format = stat_opt;
 
@@ -1504,7 +1504,7 @@ void diff_tree_combined(const struct object_id *oid,
 			needsep = 1;
 		}
 		else if (opt->output_format &
-			 (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT))
+			 (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT))
 			needsep = 1;
 		else if (opt->output_format & DIFF_FORMAT_CALLBACK)
 			handle_combined_callback(opt, paths, num_parent, num_paths);

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 19:46 git log --shortstat doesn't respect -c (but --stat does) David Turner
2018-07-10 20:34 ` Jeff King

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox