From: Junio C Hamano <hidden> Date: 2016-06-15 22:53:11
Zbigniew Jędrzejewski-Szmek [off-list ref] writes:
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.
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
From: Junio C Hamano <redacted>
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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
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
@@ -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"&&+gitadd"$name"&&+gitcommit-mmessage&&+echoa>"$name"&&+gitcommit-mmessage"$name"+'++whilereadcmdargs+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_cmpexpectactual+'++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_cmpexpectactual+'++test_expect_success"$cmd --stat-width=width with long name"'+git$cmd$args--stat-width=40>output&&+grep" | "output>actual&&+test_cmpexpectactual+'++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_cmpexpectactual+'++test_expect_success"$cmd --stat-name-width with long name"'+git$cmd$args--stat-name-width=30>output&&+grep" | "output>actual&&+test_cmpexpectactual+'+done<<\EOF+format-patch-1--stdout+diffHEAD^HEAD--stat+show--stat+log-1--stat+EOF+++test_expect_success'preparation for big change tests''+>abcd&&+gitaddabcd&&+gitcommit-mmessage&&+i=0&&+whiletest$i-lt1000+do+echo$i&&i=$(($i+1))+done>abcd&&+gitcommit-mmessageabcd+'++cat>expect80<<'EOF'+abcd|1000+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++EOF++whilereadverbexpectcmdargs+do+test_expect_success"$cmd$verb COLUMNS (big change)"'+COLUMNS=200git$cmd$args>output+grep" | "output>actual&&+test_cmp"$expect"actual+'+done<<\EOF+ignoresexpect80format-patch-1--stdout+ignoresexpect80diffHEAD^HEAD--stat+ignoresexpect80show--stat+ignoresexpect80log-1--stat+EOF++cat>expect<<'EOF'+abcd|1000+++++++++++++++++++++++++++EOF+whilereadcmdargs+do+test_expect_success"$cmd --stat=width with big change"'+git$cmd$args--stat=40>output+grep" | "output>actual&&+test_cmpexpectactual+'++test_expect_success"$cmd --stat-width=width with big change"'+git$cmd$args--stat-width=40>output+grep" | "output>actual&&+test_cmpexpectactual+'+done<<\EOF+format-patch-1--stdout+diffHEAD^HEAD--stat+show--stat+log-1--stat+EOF++test_expect_success'preparation for long filename tests''+cpabcdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&&+gitaddaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&&+gitcommit-mmessage+'++cat>expect<<'EOF'+...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|1000++++++EOF+whilereadcmdargs+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_cmpexpectactual+'+done<<\EOF+format-patch-1--stdout+diffHEAD^HEAD--stat+show--stat+log-1--stat+EOF++cat>expect80<<'EOF'+...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|1000+++++++++++++++++++++EOF+whilereadverbexpectcmdargs+do+test_expect_success"$cmd$verb COLUMNS (long filename)"'+COLUMNS=200git$cmd$args>output+grep" | "output>actual&&+test_cmp"$expect"actual+'+done<<\EOF+ignoresexpect80format-patch-1--stdout+ignoresexpect80diffHEAD^HEAD--stat+ignoresexpect80show--stat+ignoresexpect80log-1--stat+EOF++cat>expect<<'EOF'+abcd|1000+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++EOF+test_expect_success'merge --stat ignores COLUMNS (big change)''+gitcheckout-bbranchHEAD^^&&+COLUMNS=100gitmerge--stat--no-ffmaster^>output&&+grep" | "output>actual+test_cmpexpectactual+'++cat>expect<<'EOF'+...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|1000+++++++++++++++++++++EOF+test_expect_success'merge --stat ignores COLUMNS (long filename)''+COLUMNS=100gitmerge--stat--no-ffmaster>output&&+grep" | "output>actual+test_cmpexpectactual+'++test_done
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
builtin/diff.c | 3 +++
diff.c | 5 ++++-
t/t4052-stat-output.sh | 11 +++++++++--
3 files changed, 16 insertions(+), 3 deletions(-)
@@ -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);
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
Make show --stat behave like diff --stat and use the full terminal
width.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
builtin/log.c | 2 ++
t/t4052-stat-output.sh | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
Make log --stat behave like diff --stat and use the full terminal
width.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
builtin/log.c | 1 +
t/t4052-stat-output.sh | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
Make merge --stat behave like diff --stat and use the full terminal
width.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
builtin/merge.c | 1 +
t/t4052-stat-output.sh | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
The 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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
Documentation/diff-options.txt | 14 ++++---
diff.c | 90 ++++++++++++++++++++++++++--------------
t/t4052-stat-output.sh | 16 +++----
3 files changed, 76 insertions(+), 44 deletions(-)
@@ -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>`.
@@ -1343,28 +1343,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)line_prefix=msg->buf;}-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;-/* Sanity: give at least 5 columns to the graph,-*butleaveatleast10columnsforthename.-*/-if(width<25)-width=25;-if(name_width<10)-name_width=10;-elseif(width<name_width+15)-name_width=width-15;--/* Find the longest filename and max number of changes */reset=diff_get_color_opt(options,DIFF_RESET);add_c=diff_get_color_opt(options,DIFF_FILE_NEW);del_c=diff_get_color_opt(options,DIFF_FILE_OLD);+/*+*Findthelongestfilenameandmaxnumberofchanges+*/for(i=0;(i<count)&&(i<data->nr);i++){structdiffstat_file*file=data->files[i];uintmax_tchange=file->added+file->deleted;
@@ -1385,19 +1372,62 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)}count=i;/* min(count, data->nr) */-/* Compute the width of the graph part;-*10isforoneblankatthebeginningofthelineplus-*" | count "betweenthenameandthegraph.+/*+*Wehavewidth=stat_widthorterm_columns()columnstotal.+*Wewantamaximumofmin(max_len,stat_name_width)forthenamepart.+*Wealsoneed1for" "and4+decimal_width(max_change)+*for" | NNNN "andonetheemptycolumnattheend,altogether+*6+decimal_width(max_change).+*+*Ifthere'snotenoughspace,wewillusethesmallerof+*stat_name_width(ifset)and5/8*widthforthefilename,+*andtherestforconstantelements+graphpart.+*(5/8gives50forfilenameand30fortheconstantparts+graph+*forthestandardterminalsize).*-*Fromhereon,name_widthisthewidthofthenamearea,-*andwidthisthewidthofthegrapharea.+*Inotherwords:stat_widthlimitsthemaximumwidth,and+*stat_name_widthfixesthemaximumwidthofthefilename,+*andisalsousedtodivideavailablecolumnsifthere+*aren'tenough.*/-name_width=(name_width<max_len)?name_width:max_len;-if(width<(name_width+10)+max_change)-width=width-(name_width+10);++if(options->stat_width==-1)+width=term_columns();else-width=max_change;+width=options->stat_width?options->stat_width:80;+/*+*Guarantee3/8*16==6forthegraphpart+*and5/8*16==10forthefilenamepart+*/+if(width<16+6+number_width)+width=16+6+number_width;++/*+*Firstassignsizesthatarewanted,ignoringavailablewidth.+*/+graph_width=max_change;+name_width=(options->stat_name_width>0&&+options->stat_name_width<max_len)?+options->stat_name_width:max_len;++/*+*Adjustadjustablewidthsnottoexceedmaximumwidth+*/+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(name_width>width-number_width-6-graph_width)+name_width=width-number_width-6-graph_width;+else+graph_width=width-number_width-6-name_width;+}++/*+*Fromherename_widthisthewidthofthenamearea,+*andgraph_widthisthewidthofthegrapharea.+*max_changeisusedtoscalegraphproperly.+*/for(i=0;i<count;i++){constchar*prefix="";char*name=data->files[i]->print_name;
@@ -1453,18 +1483,18 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)adds+=add;dels+=del;-if(width<=max_change){+if(graph_width<=max_change){inttotal=add+del;-total=scale_linear(add+del,width,max_change);+total=scale_linear(add+del,graph_width,max_change);if(total<2&&add&&del)/* width >= 2 due to the sanity check */total=2;if(add<del){-add=scale_linear(add,width,max_change);+add=scale_linear(add,graph_width,max_change);del=total-add;}else{-del=scale_linear(del,width,max_change);+del=scale_linear(del,graph_width,max_change);add=total-del;}}
@@ -22,18 +22,18 @@ test_expect_success 'preparation' 'whilereadcmdargsdocat>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_cmpexpectactual'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_cmpexpectactual
@@ -131,11 +131,11 @@ test_expect_success 'preparation for long filename tests' '' cat>expect<<'EOF'-...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|1000++++++...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|1000++++++++++++ EOFwhilereadcmdargsdo-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_cmpexpectactual
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
In 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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
t/t4052-stat-output.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
A 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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
Documentation/diff-options.txt | 2 ++
diff.c | 23 +++++++++++++++++++++--
diff.h | 1 +
t/t4052-stat-output.sh | 6 ++++++
4 files changed, 30 insertions(+), 2 deletions(-)
@@ -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.
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:11
Config 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.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
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(-)
@@ -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
@@ -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.
@@ -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);
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:
--- expect 2012-03-26 23:41:29.688039554 +0000+++ actual 2012-03-26 23:41:29.696039549 +0000
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
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:23
$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 <redacted>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
Stupid omission. Please apply.
t/t4052-stat-output.sh | 1 +
1 file changed, 1 insertion(+)
From: Jeff King <hidden> Date: 2016-06-15 22:53:23
On Tue, Mar 27, 2012 at 07:10:03AM +0200, Zbigniew Jędrzejewski-Szmek wrote:
$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 <redacted>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
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.
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
From: Zbigniew Jędrzejewski-Szmek <hidden> Date: 2016-06-15 22:53:24
$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 <redacted>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
Right, it is better to unset $COLUMNS globally. t4016 was also affected.
t/test-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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.-unsetVISUALEMAILLANGUAGE$(perl-e'+unsetVISUALEMAILLANGUAGECOLUMNS$(perl-e'my@env=keys%ENV;my$ok=join("|",qw(TRACE
From: Jeff King <hidden> Date: 2016-06-15 22:53:24
On Tue, Mar 27, 2012 at 08:22:02AM +0200, Zbigniew Jędrzejewski-Szmek wrote:
$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 <redacted>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
Right, it is better to unset $COLUMNS globally. t4016 was also affected.
Thanks. Solves the problem for me, and looks obviously correct.
-Peff