Incremental updates to What's cooking
It is a bit too much to keep sending the full report every night, so I'll send out some highlights since issue #09 of this month for tonight.
Short term plans
----------------
Will merge to "master".
+ jb/required-filter 02-17/02-26 #1 + ph/cherry-pick-advice-refinement 02-22/02-26 #1 + pj/completion-remote-set-url-branches 02-22/02-26 #2
Will merge to "next"
- cn/maint-branch-with-bad 02-27 #1 - jk/symbolic-ref-short 02-27 #1
Will merge to "next", perhaps?
- jn/gitweb-hilite-regions 02-26 #4 - th/git-diffall 02-27 #1
Notable topics that may need more discussion
--------------------------------------------
I will not list the stalled topics here and harrass owners of them here.
* zj/diff-stat-dyncol (2012-02-27) 11 commits
- diff --stat: add config option to limit graph width
- diff --stat: enable limiting of the graph part
- diff --stat: add a test for output with COLUMNS=40
- diff --stat: use a maximum of 5/8 for the filename part
- merge --stat: use the full terminal width
- log --stat: use the full terminal width
- show --stat: use the full terminal width
- diff --stat: use the full terminal width
- diff --stat: tests for long filenames and big change counts
- t4014: addtional format-patch test vectors
- Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler
I resurrected the additional tests for format-patch from an earlier round, as it illustrates the behaviour change brought by "5/8 split" very well.
* nd/columns (2012-02-26) 11 commits
- tag: add --column
- column: support piping stdout to external git-column process
- status: add --column
- branch: add --column
- help: reuse print_columns() for help -a
- column: add column.ui for default column output settings
- column: support columns with different widths
- column: add columnar layout
- Stop starting pager recursively
- Add git-column and column mode parsing
- column: add API to print items in columns
Comments by Ramsay on the parsing code seemed reasonable.
* cb/fsck-squelch-dangling (2012-02-26) 1 commit
- fsck: do not print dangling objects by default
Introduces "fsck --dangling" and removes the output for dangling objects from the default output.
The first patch to advance this topic should add --[no-]dangling option and update the documentation to illustrate its use. On top of that, if we were to change the default not to show the dangling objects, deprecation patches that span longer timeperiod need to be built, but the follow-on patches and the default change may not be necessary, given that the command is "fsck".
* rs/no-no-no-parseopt (2012-02-26) 3 commits
- parse-options: remove PARSE_OPT_NEGHELP
- parse-options: allow positivation of options starting, with no-
- test-parse-options: convert to OPT_BOOL()
Options that use PARSE_OPT_NEGHELP needed to word their help text in a strange way, and this gets rid of the uses of them.
I tend to agree with Peff that REVERSE_BOOL or NEGBIT based solution may be more readable in the longer term. As the options that used the funny NEGHELP are limited, the difference between two approaches may not matter too much, but then that argues against fixing the funny help messages, so...
Quoted 13 lines · Junio C Hamano
* zj/diff-stat-dyncol (2012-02-27) 11 commits
- diff --stat: add config option to limit graph width
- diff --stat: enable limiting of the graph part
- diff --stat: add a test for output with COLUMNS=40
- diff --stat: use a maximum of 5/8 for the filename part
- merge --stat: use the full terminal width
- log --stat: use the full terminal width
- show --stat: use the full terminal width
- diff --stat: use the full terminal width
- diff --stat: tests for long filenames and big change counts
- t4014: addtional format-patch test vectors
- Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler
Quoted 2 lines
I resurrected the additional tests for format-patch from an earlier round, as it illustrates the behaviour change brought by "5/8 split" very well.
Hi,
the resurrected tests are partly duplicated in 4052-stat-output.sh:
t4014:
ok 75 - small change with long name gives more space to the name ok 76 - a long name is given more room when the bar is short
ok 77 - format patch --stat-width=width works with long name * ok 78 - format patch --stat=...,name-width with long name * ok 79 - format patch --stat-name-width with long name * ok 81 - format patch graph part width * ok 82 - format patch ignores COLUMNS * ok 83 - format patch --stat=width with big change * ok 84 - format patch --stat-width=width with big change *
ok 85 - partition between long name and big change is more balanced
t4052:
ok 3 - format-patch graph width defaults to 80 columns ok 4 - format-patch --stat=width with long name
ok 5 - format-patch --stat-width=width with long name ok 6 - format-patch --stat=...,name-width with long name ok 7 - format-patch --stat-name-width with long name ok 24 - format-patch ignores too many COLUMNS (big change) ok 28 - format-patch ignores not enough COLUMNS (big change) ok 29 - format-patch ignores statGraphWidth config
ok 36 - format-patch --stat=width with big change
ok 37 - format-patch --stat-width=width with big change ok 38 - format-patch --stat-graph--width with big change ok 49 - format-patch --stat=width with big change and long name ok 53 - format-patch ignores COLUMNS (long filename)
The ones with * are duplicated exactly. They tests run very fast, but maybe the duplicated ones should be culled.
Zbyszek
Quoted 47 lines · Zbigniew Jędrzejewski-Szmek
Quoted 13 lines · Junio C Hamano
* zj/diff-stat-dyncol (2012-02-27) 11 commits
- diff --stat: add config option to limit graph width
- diff --stat: enable limiting of the graph part
- diff --stat: add a test for output with COLUMNS=40
- diff --stat: use a maximum of 5/8 for the filename part
- merge --stat: use the full terminal width
- log --stat: use the full terminal width
- show --stat: use the full terminal width
- diff --stat: use the full terminal width
- diff --stat: tests for long filenames and big change counts
- t4014: addtional format-patch test vectors
- Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scalerQuoted 2 lines
I resurrected the additional tests for format-patch from an earlier round, as it illustrates the behaviour change brought by "5/8 split" very well.
Hi,
the resurrected tests are partly duplicated in4052-stat-output.sh:t4014:
ok 75 - small change with long name gives more space to the name ok 76 - a long name is given more room when the bar is shortok 77 - format patch --stat-width=width works with long name * ok 78 - format patch --stat=...,name-width with long name * ok 79 - format patch --stat-name-width with long name * ok 81 - format patch graph part width * ok 82 - format patch ignores COLUMNS * ok 83 - format patch --stat=width with big change * ok 84 - format patch --stat-width=width with big change *ok 85 - partition between long name and big change is more balanced
t4052:
ok 3 - format-patch graph width defaults to 80 columns ok 4 - format-patch --stat=width with long name
ok 5 - format-patch --stat-width=width with long name ok 6 - format-patch --stat=...,name-width with long name ok 7 - format-patch --stat-name-width with long name ok 24 - format-patch ignores too many COLUMNS (big change) ok 28 - format-patch ignores not enough COLUMNS (big change) ok 29 - format-patch ignores statGraphWidth config
ok 36 - format-patch --stat=width with big change
ok 37 - format-patch --stat-width=width with big change ok 38 - format-patch --stat-graph--width with big change ok 49 - format-patch --stat=width with big change and long name ok 53 - format-patch ignores COLUMNS (long filename)
Quoted 2 lines
The ones with * are duplicated exactly. They tests run very fast, but maybe the duplicated ones should be culled.
Yeah, probably we should de-dup them.
Compare the behaviour change shown for t4052 and for t4014 by 119c07bf. Which one more obviously show the effect of the code change to allow the reader judge if the behaviour change is going in a good direction?
The style used in t4052 only changes expect_failure to expect_success, and the reader has to accept the judgement of the person who wrote the test vector and declared "this is the _right_ output!". The way t4014, taken from your earlier round, shows the behaviour change shows how the expectation changes from the old behaviour to the new one, and the reader can see and decide which one is giving a better output.
Actually, the whole reason I didn't notice duplicates in 4052 was because of the above X-<.
If we remove duplicates, will 4052 become empty? It would be really nice if we do not have to add a new test script for this series, and instead add necessary new tests to existing scripts.
Quoted 49 lines · Junio C Hamano
Quoted 47 lines · Zbigniew Jędrzejewski-Szmek
Quoted 13 lines · Junio C Hamano
* zj/diff-stat-dyncol (2012-02-27) 11 commits
- diff --stat: add config option to limit graph width
- diff --stat: enable limiting of the graph part
- diff --stat: add a test for output with COLUMNS=40
- diff --stat: use a maximum of 5/8 for the filename part
- merge --stat: use the full terminal width
- log --stat: use the full terminal width
- show --stat: use the full terminal width
- diff --stat: use the full terminal width
- diff --stat: tests for long filenames and big change counts
- t4014: addtional format-patch test vectors
- Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scalerQuoted 2 lines
I resurrected the additional tests for format-patch from an earlier round, as it illustrates the behaviour change brought by "5/8 split" very well.
Hi,
the resurrected tests are partly duplicated in4052-stat-output.sh:t4014:
ok 75 - small change with long name gives more space to the name ok 76 - a long name is given more room when the bar is shortok 77 - format patch --stat-width=width works with long name * ok 78 - format patch --stat=...,name-width with long name * ok 79 - format patch --stat-name-width with long name * ok 81 - format patch graph part width * ok 82 - format patch ignores COLUMNS * ok 83 - format patch --stat=width with big change * ok 84 - format patch --stat-width=width with big change *ok 85 - partition between long name and big change is more balanced
t4052:
ok 3 - format-patch graph width defaults to 80 columns ok 4 - format-patch --stat=width with long name
ok 5 - format-patch --stat-width=width with long name ok 6 - format-patch --stat=...,name-width with long name ok 7 - format-patch --stat-name-width with long name ok 24 - format-patch ignores too many COLUMNS (big change) ok 28 - format-patch ignores not enough COLUMNS (big change) ok 29 - format-patch ignores statGraphWidth config
ok 36 - format-patch --stat=width with big change
ok 37 - format-patch --stat-width=width with big change ok 38 - format-patch --stat-graph--width with big change ok 49 - format-patch --stat=width with big change and long name ok 53 - format-patch ignores COLUMNS (long filename)
Quoted 8 lines
Quoted 2 lines
The ones with * are duplicated exactly. They tests run very fast, but maybe the duplicated ones should be culled.
Yeah, probably we should de-dup them.
Compare the behaviour change shown for t4052 and for t4014 by
119c07bf. Which one more obviously show the effect of the code change to allow the reader judge if the behaviour change is going in a good direction?
t4014 it seems, but mostly because of more descriptive test names.
But this is only true for the ones without *, I think. So the ones with * can be deleted without losing this advantage.
The ones with * are very similar in t4014 and t4052.
Quoted 7 lines
The style used in t4052 only changes
expect_failuretoexpect_success, and the reader has to accept the judgement of the person who wrote the test vector and declared "this is the _right_ output!". The way t4014, taken from your earlier round, shows the behaviour change shows how the expectation changes from the old behaviour to the new one, and the reader can see and decide which one is giving a better output.
Quoted 6 lines
Actually, the whole reason I didn't notice duplicates in 4052 was because of the above X-<.
If we remove duplicates, will 4052 become empty? It would be really nice if we do not have to add a new test script for this series, and instead add necessary new tests to existing scripts.
t4052 tests show, log, merge, diff and format-patch with basically the same commands. Separating the tests into different files would require duplicating a lot of setup code. OTOH, t4014 is only about format-patch, so the other ones don't fit. I thought it would be better to create a new file.
-
Zbyszek
Quoted 5 lines · Zbigniew Jędrzejewski-Szmek
t4052 tests show, log, merge, diff and format-patch with basically the same commands. Separating the tests into different files would require duplicating a lot of setup code. OTOH, t4014 is only about format-patch, so the other ones don't fit. I thought it would be better to create a new file.
OK, then perhaps we want to move the versions of duplicated one them from 4014 to 4052?
Thanks.
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Zbigniew Jędrzejewski-Szmek
t4052 tests show, log, merge, diff and format-patch with basically the same commands. Separating the tests into different files would require duplicating a lot of setup code. OTOH, t4014 is only about format-patch, so the other ones don't fit. I thought it would be better to create a new file.
OK, then perhaps we want to move the versions of duplicated one them from 4014 to 4052?
Do you mean move a version of non-duplicated ones from t4014 to t4052 and remove the duplicated ones?
Zbyszek
Quoted 2 lines · Zbigniew Jędrzejewski-Szmek
Do you mean move a version of non-duplicated ones from t4014 to t4052 and remove the duplicated ones?
Err, non-duplicated ones do not have anything to do with your series, no? They are good copies you inherited from people who touched the file before you, and we can leave the file in the state before this series.
Among the ones added to t4014, there are ones that have moral equivalent in t4052. These in t4052 are however less nice. So I was suggesting to replace these less nice ones in t4052 with their equivalents in t4014. With such an update to t4052, the ones in t4014 that are duplicates in the today's code can be removed, as we would have identical copies of them in t4052.
PATCH 1/9 diff --stat: tests for long filenames and big change counts
From: Junio C Hamano <[email protected]>
In preparation for updates to the "diff --stat" that updates the logic to split the allotted columns into the name part and the graph part to make the output more readable, add a handful of tests to document the corner case behaviour in which long filenames and big changes are shown.
When a pathname is so long that it cannot fit on the column, the current code truncates it to make sure that the graph part has enough room to show a meaningful graph. If the actual change is small (e.g. only one line changed), this results in the final output that is shorter than the width we aim for.
---
v7a:
De-decuplicate new tests added in t4014 and t4052. Test descriptions are taken from t4014, but the tests are all added in t4052.
This patch is a merge of 't4014: addtional format-patch test vectors' from Junio C Hamano and v7 of my 'diff --stat: tests for long filenames and big change counts'.
The rest of the series is only updated to apply cleanly after the changes to tests.
[This patch series does not include the additional patches to minimize the number of columns used for the change count number.]
t/t4052-stat-output.sh | 182 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100755 t/t4052-stat-output.sh
t/t4052-stat-output.sh new file +182 -0
@@ -0,0 +1,182 @@ +#!/bin/sh +# +# Copyright (c) 2012 Zbigniew Jędrzejewski-Szmek +# + +test_description='test --stat output of various commands' + +. ./test-lib.sh +. "$TEST_DIRECTORY"/lib-terminal.sh + +# 120 character name +name=aaaaaaaaaa +name=$name$name$name$name$name$name$name$name$name$name$name$name +test_expect_success 'preparation' ' + >"$name" && + git add "$name" && + git commit -m message && + echo a >"$name" && + git commit -m message "$name" +' + +while read cmd args +do + cat >expect <<-'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + + EOF + test_expect_success "$cmd: a short graph bar does not extend to the full width" ' + git $cmd $args >output && + grep " | " output >actual && + test_cmp expect actual + ' + + cat >expect <<-'EOF' + ...aaaaaaaaaaaaaaaaaaaaaa | 1 + + EOF + test_expect_success "$cmd --stat=width: name is chopped to leave room to the right of a short bar" ' + git $cmd $args --stat=40 >output && + grep " | " output >actual && + test_cmp expect actual + ' + + test_expect_success "$cmd --stat-width=width with long name" ' + git $cmd $args --stat-width=40 >output && + grep " | " output >actual && + test_cmp expect actual + ' + + cat >expect <<-'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + + EOF + test_expect_success "$cmd --stat=...,name-width with long name" ' + git $cmd $args --stat=60,30 >output && + grep " | " output >actual && + test_cmp expect actual + ' + + test_expect_success "$cmd --stat-name-width with long name" ' + git $cmd $args --stat-name-width=30 >output && + grep " | " output >actual && + test_cmp expect actual + ' +done <<\EOF +format-patch -1 --stdout +diff HEAD^ HEAD --stat +show --stat +log -1 --stat +EOF + + +test_expect_success 'preparation for big change tests' ' + >abcd && + git add abcd && + git commit -m message && + i=0 && + while test $i -lt 1000 + do + echo $i && i=$(($i + 1)) + done >abcd && + git commit -m message abcd +' + +cat >expect80 <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF + +while read verb expect cmd args +do + test_expect_success "$cmd $verb COLUMNS (big change)" ' + COLUMNS=200 git $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' +done <<\EOF +ignores expect80 format-patch -1 --stdout +ignores expect80 diff HEAD^ HEAD --stat +ignores expect80 show --stat +ignores expect80 log -1 --stat +EOF + +cat >expect <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++ +EOF +while read cmd args +do + test_expect_success "$cmd --stat=width with big change" ' + git $cmd $args --stat=40 >output + grep " | " output >actual && + test_cmp expect actual + ' + + test_expect_success "$cmd --stat-width=width with big change" ' + git $cmd $args --stat-width=40 >output + grep " | " output >actual && + test_cmp expect actual + ' +done <<\EOF +format-patch -1 --stdout +diff HEAD^ HEAD --stat +show --stat +log -1 --stat +EOF + +test_expect_success 'preparation for long filename tests' ' + cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && + git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && + git commit -m message +' + +cat >expect <<'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++ +EOF +while read cmd args +do + test_expect_success "$cmd --stat=width with big change and long name favors name part" ' + git $cmd $args --stat-width=60 >output && + grep " | " output >actual && + test_cmp expect actual + ' +done <<\EOF +format-patch -1 --stdout +diff HEAD^ HEAD --stat +show --stat +log -1 --stat +EOF + +cat >expect80 <<'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ +EOF +while read verb expect cmd args +do + test_expect_success "$cmd $verb COLUMNS (long filename)" ' + COLUMNS=200 git $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' +done <<\EOF +ignores expect80 format-patch -1 --stdout +ignores expect80 diff HEAD^ HEAD --stat +ignores expect80 show --stat +ignores expect80 log -1 --stat +EOF + +cat >expect <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF +test_expect_success 'merge --stat ignores COLUMNS (big change)' ' + git checkout -b branch HEAD^^ && + COLUMNS=100 git merge --stat --no-ff master^ >output && + grep " | " output >actual + test_cmp expect actual +' + +cat >expect <<'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ +EOF +test_expect_success 'merge --stat ignores COLUMNS (long filename)' ' + COLUMNS=100 git merge --stat --no-ff master >output && + grep " | " output >actual + test_cmp expect actual +' + +test_done
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 2/9 diff --stat: use the full terminal width
Default to the real terminal width for diff --stat output, instead of the hard-coded 80 columns.
Some projects (especially in Java), have long filename paths, with nested directories or long individual filenames. When files are renamed, the filename part in stat output can be almost useless. If the middle part between { and } is long (because the file was moved to a completely different directory), then most of the path would be truncated.
It makes sense to detect and use the full terminal width and display full filenames if possible.
The are commands like diff, show, and log, which can adapt the output to the terminal width. There are also commands like format-patch, whose output should be independent of the terminal width. Since it is safer to use the 80-column default, the real terminal width is only used if requested by the calling code by setting diffopts.stat_width=-1. Normally this value is 0, and can be set by the user only to a non-negative value, so -1 is safe to use internally.
This patch only changes the diff builtin to use the full terminal width.
--- builtin/diff.c | 3 +++ diff.c | 5 ++++- t/t4052-stat-output.sh | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-)
builtin/diff.c +3 -0
@@ -285,6 +285,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)/* Otherwise, we are doing the usual "git" diff */ rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index; +/* Scale to real terminal size */ + rev.diffopt.stat_width =-1 ; +/* Default to let external and textconv be used */ DIFF_OPT_SET (&rev.diffopt,ALLOW_EXTERNAL );DIFF_OPT_SET (&rev.diffopt,ALLOW_TEXTCONV );
diff.c +4 -1
@@ -1343,7 +1343,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) line_prefix = msg->buf; } - width = options->stat_width ? options->stat_width :80 ; +if (options->stat_width ==-1 ) + width =term_columns (); +else + width = options->stat_width ? options->stat_width :80 ; name_width = options->stat_name_width ? options->stat_name_width :50 ; count = options->stat_count ? options->stat_count : data->nr;
t/t4052-stat-output.sh +9 -2
@@ -83,6 +83,10 @@ cat >expect80 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF +cat >expect200 <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF + while read verb expect cmd args do test_expect_success "$cmd $verb COLUMNS (big change)" '
@@ -92,7 +96,7 @@ do ' done <<\EOF ignores expect80 format-patch -1 --stdout -ignores expect80 diff HEAD^ HEAD --stat +respects expect200 diff HEAD^ HEAD --stat ignores expect80 show --stat ignores expect80 log -1 --stat EOF
@@ -146,6 +150,9 @@ EOF cat >expect80 <<'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ EOF +cat >expect200 <<'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF while read verb expect cmd args do test_expect_success "$cmd $verb COLUMNS (long filename)" '
@@ -155,7 +162,7 @@ do ' done <<\EOF ignores expect80 format-patch -1 --stdout -ignores expect80 diff HEAD^ HEAD --stat +respects expect200 diff HEAD^ HEAD --stat ignores expect80 show --stat ignores expect80 log -1 --stat EOF
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 3/9 show --stat: use the full terminal width
In reply to Zbigniew Jędrzejewski-SzmekMake show --stat behave like diff --stat and use the full terminal width.
--- builtin/log.c | 2 ++ t/t4052-stat-output.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
builtin/log.c +2 -0
@@ -447,6 +447,8 @@ int cmd_show(int argc, const char **argv, const char *prefix) rev.diff =1 ; rev.always_show_header =1 ; rev.no_walk =1 ; + rev.diffopt.stat_width =-1 ;/* Scale to real terminal size */ +memset (&opt,0 ,sizeof (opt)); opt.def ="HEAD" ; opt.tweak = show_rev_tweak_rev;
t/t4052-stat-output.sh +2 -2
@@ -97,7 +97,7 @@ do done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat -ignores expect80 show --stat +respects expect200 show --stat ignores expect80 log -1 --stat EOF
@@ -163,7 +163,7 @@ do done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat -ignores expect80 show --stat +respects expect200 show --stat ignores expect80 log -1 --stat EOF
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 4/9 log --stat: use the full terminal width
In reply to Zbigniew Jędrzejewski-SzmekMake log --stat behave like diff --stat and use the full terminal width.
--- builtin/log.c | 1 + t/t4052-stat-output.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
builtin/log.c +1 -0
@@ -77,6 +77,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)get_commit_format (fmt_pretty, rev); rev->verbose_header =1 ;DIFF_OPT_SET (&rev->diffopt,RECURSIVE ); + rev->diffopt.stat_width =-1 ;/* use full terminal width */ rev->abbrev_commit = default_abbrev_commit; rev->show_root_diff = default_show_root; rev->subject_prefix = fmt_patch_subject_prefix;
t/t4052-stat-output.sh +2 -2
@@ -98,7 +98,7 @@ done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat respects expect200 show --stat -ignores expect80 log -1 --stat +respects expect200 log -1 --stat EOF cat >expect <<'EOF'
@@ -164,7 +164,7 @@ done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat respects expect200 show --stat -ignores expect80 log -1 --stat +respects expect200 log -1 --stat EOF cat >expect <<'EOF'
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 5/9 merge --stat: use the full terminal width
In reply to Zbigniew Jędrzejewski-SzmekMake merge --stat behave like diff --stat and use the full terminal width.
--- builtin/merge.c | 1 + t/t4052-stat-output.sh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-)
builtin/merge.c +1 -0
@@ -399,6 +399,7 @@ static void finish(struct commit *head_commit,if (new_head && show_diffstat) {struct diff_options opts;diff_setup (&opts); + opts.stat_width =-1 ;/* use full terminal width */ opts.output_format |=DIFF_FORMAT_SUMMARY |DIFF_FORMAT_DIFFSTAT ; opts.detect_rename =DIFF_DETECT_RENAME ;
t/t4052-stat-output.sh +4 -4
@@ -168,9 +168,9 @@ respects expect200 log -1 --stat EOF cat >expect <<'EOF' - abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF -test_expect_success 'merge --stat ignores COLUMNS (big change)' ' +test_expect_success 'merge --stat respects COLUMNS (big change)' ' git checkout -b branch HEAD^^ && COLUMNS=100 git merge --stat --no-ff master^ >output && grep " | " output >actual
@@ -178,9 +178,9 @@ test_expect_success 'merge --stat ignores COLUMNS (big change)' ' ' cat >expect <<'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++ EOF -test_expect_success 'merge --stat ignores COLUMNS (long filename)' ' +test_expect_success 'merge --stat respects COLUMNS (long filename)' ' COLUMNS=100 git merge --stat --no-ff master >output && grep " | " output >actual test_cmp expect actual
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 6/9 diff --stat: use a maximum of 5/8 for the filename part
In reply to Zbigniew Jędrzejewski-SzmekThe way that available columns are divided between the filename part and the graph part is modified to use as many columns as necessary for the filenames and the rest for the graph.
If there isn't enough columns to print both the filename and the graph, at least 5/8 of available space is devoted to filenames. On a standard 80 column terminal, or if not connected to a terminal and using the default of 80 columns, this gives the same partition as before.
The effect of this change is visible in the patch to the test vector in t4014; with a small change with long filename, it stops truncating the name part too short, and also allocates a bit more columns to the graph for larger changes. t4052 shows a similar change.
--- Documentation/diff-options.txt | 14 ++++--- diff.c | 90 ++++++++++++++++++++++++++-------------- t/t4052-stat-output.sh | 16 +++---- 3 files changed, 76 insertions(+), 44 deletions(-)
Documentation/diff-options.txt +8 -6
@@ -53,13 +53,15 @@ endif::git-format-patch[] Generate a diff using the "patience diff" algorithm. --stat[=<width>[,<name-width>[,<count>]]]:: - Generate a diffstat. You can override the default - output width for 80-column terminal by `--stat=<width>`. - The width of the filename part can be controlled by - giving another width to it separated by a comma. + Generate a diffstat. By default, as much space as necessary + will be used for the filename part, and the rest for + the graph part. Maximum width defaults to terminal width, + or 80 columns if not connected to a terminal, and can be + overriden by `<width>`. The width of the filename part can be + limited by giving another width `<name-width>` after a comma. By giving a third parameter `<count>`, you can limit the - output to the first `<count>` lines, followed by - `...` if there are more. + output to the first `<count>` lines, followed by `...` if + there are more. + These parameters can also be set individually with `--stat-width=<width>`, `--stat-name-width=<name-width>` and `--stat-count=<count>`.
diff.c +60 -30
132 lines not on this page · raw message
t/t4052-stat-output.sh +8 -8
@@ -22,18 +22,18 @@ test_expect_success 'preparation' ' while read cmd args do cat >expect <<-'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + EOF - test_expect_success "$cmd: a short graph bar does not extend to the full width" ' + test_expect_success "$cmd: small change with long name gives more space to the name" ' git $cmd $args >output && grep " | " output >actual && test_cmp expect actual ' cat >expect <<-'EOF' - ...aaaaaaaaaaaaaaaaaaaaaa | 1 + + ...aaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + EOF - test_expect_success "$cmd --stat=width: name is chopped to leave room to the right of a short bar" ' + test_expect_success "$cmd --stat=width: a long name is given more room when the bar is short" ' git $cmd $args --stat=40 >output && grep " | " output >actual && test_cmp expect actual
@@ -131,11 +131,11 @@ test_expect_success 'preparation for long filename tests' ' ' cat >expect <<'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++ + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++ EOF while read cmd args do - test_expect_success "$cmd --stat=width with big change and long name favors name part" ' + test_expect_success "$cmd --stat=width with big change is more balanced" ' git $cmd $args --stat-width=60 >output && grep " | " output >actual && test_cmp expect actual
@@ -151,7 +151,7 @@ cat >expect80 <<'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ EOF cat >expect200 <<'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF while read verb expect cmd args do
@@ -178,7 +178,7 @@ test_expect_success 'merge --stat respects COLUMNS (big change)' ' ' cat >expect <<'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++ EOF test_expect_success 'merge --stat respects COLUMNS (long filename)' ' COLUMNS=100 git merge --stat --no-ff master >output &&
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
Re: [PATCH v7a 6/9] diff --stat: use a maximum of 5/8 for the filename part
Quoted 4 lines · Zbigniew Jędrzejewski-Szmek
The effect of this change is visible in the patch to the test vector in t4014; with a small change with long filename, it stops truncating the name part too short, and also allocates a bit more columns to the graph for larger changes. t4052 shows a similar change.
I replaced 4014 with 4052 in the first sentence, and dropped the last sentence and re-queued the whole series.
Thanks for cleaning it up. Very much appreciated.
Re: [PATCH v7a 6/9] diff --stat: use a maximum of 5/8 for the filename part
In reply to Zbigniew Jędrzejewski-SzmekQuoted 5 lines · Zbigniew Jędrzejewski-Szmek
--- Documentation/diff-options.txt | 14 ++++--- diff.c | 90 ++++++++++++++++++++++++++-------------- t/t4052-stat-output.sh | 16 +++---- 3 files changed, 76 insertions(+), 44 deletions(-)
I am seeing test failures from t4052 in 'master'. Bisecting points to 1b058bc (diff --stat: use a maximum of 5/8 for the filename part, 2012-03-01). The output from the test script looks like this:
actual 2012-03-26 23:41:29.696039549 +0000 renamed from expect 2012-03-26 23:41:29.688039554 +0000 +1 -1
@@ -1 +1 @@ - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
not ok - 8 diff: small change with long name gives more space to the name #
# git $cmd $args >output && # grep " | " output >actual && # test_cmp expect actual
#
There are a few other failures, but they all have the same mismatched length (the output is slightly longer than expected). I know Junio won't push out a 'master' that doesn't pass the tests for him, so I'm wondering if some environment information like the terminal width is leaking through the test scripts.
I haven't actually investigated any further yet, but I thought I'd first see if anything obvious occurs to you.
-Peff
PATCH 1/1 t4052: unset $COLUMNS inherited from environment
$COLUMNS must be unset to not interfere with the tests. The tests already ignore the terminal size because output is redirected to a file, but $COLUMNS overrides terminal size detection and changes the test output away from the standard 80 even if not on a terminal.
---
Stupid omission. Please apply.
t/t4052-stat-output.sh | 1 + 1 file changed, 1 insertion(+)
t/t4052-stat-output.sh +1 -0
@@ -17,6 +17,7 @@ test_expect_success 'preparation' ' git commit -m message && echo a >"$name" && git commit -m message "$name" + sane_unset COLUMNS ' while read cmd args
Signature · 1 line
1.7.10.rc1.222.gc0040.dirty
Re: [PATCH] t4052: unset $COLUMNS inherited from environment
Quoted 9 lines · Zbigniew Jędrzejewski-Szmek
$COLUMNS must be unset to not interfere with the tests. The tests already ignore the terminal size because output is redirected to a file, but $COLUMNS overrides terminal size detection and changes the test output away from the standard 80 even if not on a terminal.
Reported-by Jeff King <[email protected]>Signed-off-by Zbigniew Jędrzejewski-Szmek <[email protected]>---
Stupid omission. Please apply.
Thanks. I had a feeling it was something like this, but when I went to test again, I couldn't reproduce! It seems that COLUMNS is not exported by default, but somehow I must have exported it accidentally.
t/t4052-stat-output.sh test_expect_success 'preparation' ' · line 21
Quoted 10 lines
t/t4052-stat-output.sh +1
-0@@ -17,6 +17,7 @@ test_expect_success 'preparation' ' git commit -m message && echo a >"$name" && git commit -m message "$name" + sane_unset COLUMNS '
Should we perhaps just unset it in test-lib.sh, along with the other variables that cause an inconsistent test environment? This is the only test script that breaks now, but there's no reason not to protect all of the scripts.
-Peff
PATCH v2 1/1 tests: unset COLUMNS inherited from environment
$COLUMNS must be unset to not interfere with the tests. The tests already ignore the terminal size because output is redirected to a file, but COLUMNS overrides terminal size detection and changes the test output away from the standard 80.
---
Right, it is better to unset $COLUMNS globally. t4016 was also affected.
t/test-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/test-lib.sh +1 -1
@@ -46,7 +46,7 @@ EDITOR=: # /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets # deriving from the command substitution clustered with the other # ones. -unset VISUAL EMAIL LANGUAGE $(perl -e ' +unset VISUAL EMAIL LANGUAGE COLUMNS $(perl -e ' my @env = keys %ENV; my $ok = join("|", qw( TRACE
Signature · 1 line
1.7.10.rc1.222.gc0040.dirty
Re: [PATCH v2] tests: unset COLUMNS inherited from environment
Quoted 9 lines · Zbigniew Jędrzejewski-Szmek
$COLUMNS must be unset to not interfere with the tests. The tests already ignore the terminal size because output is redirected to a file, but COLUMNS overrides terminal size detection and changes the test output away from the standard 80.
Reported-by Jeff King <[email protected]>Signed-off-by Zbigniew Jędrzejewski-Szmek <[email protected]>---
Right, it is better to unset $COLUMNS globally. t4016 was also affected.
Thanks. Solves the problem for me, and looks obviously correct.
-Peff
Re: [PATCH] t4052: unset $COLUMNS inherited from environment
In reply to Zbigniew Jędrzejewski-SzmekAm 3/27/2012 7:10, schrieb Zbigniew Jędrzejewski-Szmek:
t/t4052-stat-output.sh test_expect_success 'preparation' ' · line 21
Quoted 10 lines
t/t4052-stat-output.sh +1
-0@@ -17,6 +17,7 @@ test_expect_success 'preparation' ' git commit -m message && echo a >"$name" && git commit -m message "$name" + sane_unset COLUMNS '
Watch out, the && chain is broken here.
-- Hannes
PATCH 7/9 diff --stat: add a test for output with COLUMNS=40
In reply to Zbigniew Jędrzejewski-SzmekIn preparation for the introduction on the limit of the width of the graph part, a new test with COLUMNS=40 is added to check that the environment variable influences diff, show, log, but not format-patch. A new test is added because limiting the graph part makes COLUMNS=200 stop influencing diff --stat behaviour, which isn't wide enough now. The old test with COLUMNS=200 is retained to check for regressions.
--- t/t4052-stat-output.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
t/t4052-stat-output.sh +19 -0
@@ -101,6 +101,25 @@ respects expect200 show --stat respects expect200 log -1 --stat EOF +cat >expect40 <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++ +EOF + +while read verb expect cmd args +do + test_expect_success "$cmd $verb not enough COLUMNS (big change)" ' + COLUMNS=40 git $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' +done <<\EOF +ignores expect80 format-patch -1 --stdout +respects expect40 diff HEAD^ HEAD --stat +respects expect40 show --stat +respects expect40 log -1 --stat +EOF + + cat >expect <<'EOF' abcd | 1000 ++++++++++++++++++++++++++ EOF
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 8/9 diff --stat: enable limiting of the graph part
In reply to Zbigniew Jędrzejewski-SzmekA new option --stat-graph-width=<width> can be used to limit the width of the graph part even is more space is available. Up to <width> columns will be used for the graph.
If commits changing a lot of lines are displayed in a wide terminal window (200 or more columns), and the +- graph uses the full width, the output can be hard to comfortably scan with a horizontal movement of human eyes. Messages wrapped to about 80 columns would be interspersed with very long +- lines. It makes sense to limit the width of the graph part to a fixed value (e.g. 70 columns), even if more columns are available.
--- Documentation/diff-options.txt | 2 ++ diff.c | 23 +++++++++++++++++++++-- diff.h | 1 + t/t4052-stat-output.sh | 6 ++++++ 4 files changed, 30 insertions(+), 2 deletions(-)
Documentation/diff-options.txt +2 -0
@@ -59,6 +59,8 @@ endif::git-format-patch[] or 80 columns if not connected to a terminal, and can be overriden by `<width>`. The width of the filename part can be limited by giving another width `<name-width>` after a comma. + The width of the graph part can be limited by using + `--stat-graph-width=<width>`. By giving a third parameter `<count>`, you can limit the output to the first `<count>` lines, followed by `...` if there are more.
diff.c +21 -2
@@ -1375,13 +1375,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)/* * We have width = stat_width or term_columns() columns total. * We want a maximum of min(max_len, stat_name_width) for the name part. +* We want a maximum of min(max_change, stat_graph_width) for the +- part. * We also need 1 for " " and 4 + decimal_width(max_change) * for " | NNNN " and one the empty column at the end, altogether * 6 + decimal_width(max_change). * * If there's not enough space, we will use the smaller of * stat_name_width (if set) and 5/8*width for the filename, -* and the rest for constant elements + graph part. +* and the rest for constant elements + graph part, but no more +* than stat_graph_width for the graph part. * (5/8 gives 50 for filename and 30 for the constant parts + graph * for the standard terminal size). *
@@ -1406,7 +1408,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)/* * First assign sizes that are wanted, ignoring available width. */ - graph_width = max_change; + graph_width = (options->stat_graph_width && + options->stat_graph_width < max_change) ? + options->stat_graph_width : max_change; name_width = (options->stat_name_width >0 && options->stat_name_width < max_len) ? options->stat_name_width : max_len;
@@ -1417,6 +1421,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)if (name_width + number_width +6 + graph_width > width) {if (graph_width > width *3 /8 - number_width -6 ) graph_width = width *3 /8 - number_width -6 ; +if (options->stat_graph_width && + graph_width > options->stat_graph_width) + graph_width = options->stat_graph_width;if (name_width > width - number_width -6 - graph_width) name_width = width - number_width -6 - graph_width;else
@@ -3289,6 +3296,7 @@ static int stat_opt(struct diff_options *options, const char **av)char *end;int width = options->stat_width;int name_width = options->stat_name_width; +int graph_width = options->stat_graph_width;int count = options->stat_count;int argcount =1 ;
@@ -3317,6 +3325,16 @@ static int stat_opt(struct diff_options *options, const char **av) name_width =strtoul (av[1 ], &end,10 ); argcount =2 ; } + }else if (!prefixcmp (arg,"-graph-width" )) { + arg +=strlen ("-graph-width" ); +if (*arg =='=' ) + graph_width =strtoul (arg +1 , &end,10 ); +else if (!*arg && !av[1 ]) +die ("Option '--stat-graph-width' requires a value" ); +else if (!*arg) { + graph_width =strtoul (av[1 ], &end,10 ); + argcount =2 ; + } }else if (!prefixcmp (arg,"-count" )) { arg +=strlen ("-count" );if (*arg =='=' )
@@ -3342,6 +3360,7 @@ static int stat_opt(struct diff_options *options, const char **av)return 0 ; options->output_format |=DIFF_FORMAT_DIFFSTAT ; options->stat_name_width = name_width; + options->stat_graph_width = graph_width; options->stat_width = width; options->stat_count = count;return argcount;
diff.h +1 -0
@@ -129,6 +129,7 @@ struct diff_options {int stat_width;int stat_name_width; +int stat_graph_width;int stat_count;const char *word_regex;enum diff_words_type word_diff;
t/t4052-stat-output.sh +6 -0
@@ -136,6 +136,12 @@ do grep " | " output >actual && test_cmp expect actual ' + + test_expect_success "$cmd --stat-graph--width with big change" ' + git $cmd $args --stat-graph-width=26 >output + grep " | " output >actual && + test_cmp expect actual + ' done <<\EOF format-patch -1 --stdout diff HEAD^ HEAD --stat
Signature · 1 line
1.7.9.2.399.gdf4d.dirty
PATCH 9/9 diff --stat: add config option to limit graph width
In reply to Zbigniew Jędrzejewski-SzmekConfig option diff.statGraphWidth=<width> is equivalent to --stat-graph-width=<width>, except that the config option is ignored by format-patch.
For the graph-width limiting to be usable, it should happen 'automatically' once configured, hence the config option. Nevertheless, graph width limiting only makes sense when used on a wide terminal, so it should not influence the output of format-patch, which adheres to the 80-column standard.
--- Documentation/diff-config.txt | 4 ++++ Documentation/diff-options.txt | 16 +++++++++------- builtin/diff.c | 3 ++- builtin/log.c | 1 + builtin/merge.c | 1 + contrib/completion/git-completion.bash | 1 + diff.c | 8 ++++++++ t/t4052-stat-output.sh | 6 ++++++ 8 files changed, 32 insertions(+), 8 deletions(-)
Documentation/diff-config.txt +4 -0
@@ -52,6 +52,10 @@ directories with less than 10% of the total amount of changed files, and accumulating child directory counts in the parent directories: `files,10,cumulative`. +diff.statGraphWidth:: + Limit the width of the graph part in --stat output. If set, applies + to all commands generating --stat outuput except format-patch. + diff.external:: If this config variable is set, diff generation is not performed using the internal diff machinery, but using the
Documentation/diff-options.txt +9 -7
@@ -54,13 +54,15 @@ endif::git-format-patch[] --stat[=<width>[,<name-width>[,<count>]]]:: Generate a diffstat. By default, as much space as necessary - will be used for the filename part, and the rest for - the graph part. Maximum width defaults to terminal width, - or 80 columns if not connected to a terminal, and can be - overriden by `<width>`. The width of the filename part can be - limited by giving another width `<name-width>` after a comma. - The width of the graph part can be limited by using - `--stat-graph-width=<width>`. + will be used for the filename part, and the rest for the graph + part. Maximum width defaults to terminal width, or 80 columns + if not connected to a terminal, and can be overriden by + `<width>`. The width of the filename part can be limited by + giving another width `<name-width>` after a comma. The width + of the graph part can be limited by using + `--stat-graph-width=<width>` (affects all commands generating + a stat graph) or by setting `diff.statGraphWidth=<width>` + (does not affect `git format-patch`). By giving a third parameter `<count>`, you can limit the output to the first `<count>` lines, followed by `...` if there are more.
builtin/diff.c +2 -1
@@ -285,8 +285,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)/* Otherwise, we are doing the usual "git" diff */ rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index; -/* Scale to real terminal size */ +/* Scale to real terminal size and respect statGraphWidth config */ rev.diffopt.stat_width =-1 ; + rev.diffopt.stat_graph_width =-1 ;/* Default to let external and textconv be used */ DIFF_OPT_SET (&rev.diffopt,ALLOW_EXTERNAL );
builtin/log.c +1 -0
@@ -78,6 +78,7 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev->verbose_header =1 ;DIFF_OPT_SET (&rev->diffopt,RECURSIVE ); rev->diffopt.stat_width =-1 ;/* use full terminal width */ + rev->diffopt.stat_graph_width =-1 ;/* respect statGraphWidth config */ rev->abbrev_commit = default_abbrev_commit; rev->show_root_diff = default_show_root; rev->subject_prefix = fmt_patch_subject_prefix;
builtin/merge.c +1 -0
@@ -400,6 +400,7 @@ static void finish(struct commit *head_commit,struct diff_options opts;diff_setup (&opts); opts.stat_width =-1 ;/* use full terminal width */ + opts.stat_graph_width =-1 ;/* respect statGraphWidth config */ opts.output_format |=DIFF_FORMAT_SUMMARY |DIFF_FORMAT_DIFFSTAT ; opts.detect_rename =DIFF_DETECT_RENAME ;
contrib/completion/git-completion.bash +1 -0
@@ -2118,6 +2118,7 @@ _git_config () core.whitespace core.worktree diff.autorefreshindex + diff.statGraphWidth diff.external diff.ignoreSubmodules diff.mnemonicprefix
diff.c +8 -0
@@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg;int diff_auto_refresh_index =1 ;static int diff_mnemonic_prefix;static int diff_no_prefix; +static int diff_stat_graph_width;static int diff_dirstat_permille_default =30 ;static struct diff_options default_diff_options;
@@ -156,6 +157,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) diff_no_prefix =git_config_bool (var, value);return 0 ; } +if (!strcmp (var,"diff.statgraphwidth" )) { + diff_stat_graph_width =git_config_int (var, value); +return 0 ; + }if (!strcmp (var,"diff.external" ))return git_config_string (&external_diff_cmd_cfg, var, value);if (!strcmp (var,"diff.wordregex" ))
@@ -1398,6 +1403,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)else width = options->stat_width ? options->stat_width :80 ; +if (options->stat_graph_width ==-1 ) + options->stat_graph_width = diff_stat_graph_width; +/* * Guarantee 3/8*16==6 for the graph part * and 5/8*16==10 for the filename part
t/t4052-stat-output.sh +6 -0
@@ -112,6 +112,12 @@ do grep " | " output >actual && test_cmp "$expect" actual ' + + test_expect_success "$cmd $verb statGraphWidth config" ' + git -c diff.statGraphWidth=26 $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' done <<\EOF ignores expect80 format-patch -1 --stdout respects expect40 diff HEAD^ HEAD --stat
Signature · 1 line
1.7.9.2.399.gdf4d.dirty