aboutsummaryrefslogtreecommitdiff
path: root/t/t4052-stat-output.sh
Commit message (Collapse)AuthorAge
* Merge branch 'zj/diff-stat-smaller-num-columns'Junio C Hamano2012-05-02
|\ | | | | | | | | | | | | | | | | | | Spend only minimum number of columns necessary to show the number of lines in the output from "diff --stat", instead of always allocating 4 columns even when showing changes that are much smaller than 1000 lines. By Zbigniew Jędrzejewski-Szmek * zj/diff-stat-smaller-num-columns: diff --stat: use less columns for change counts
| * diff --stat: use less columns for change countsZbigniew Jędrzejewski-Szmek2012-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Number of columns required for change counts is now computed based on the maximum number of changed lines instead of being fixed. This means that usually a few more columns will be available for the filenames and the graph. The graph width logic is also modified to include enough space for "Bin XXX -> YYY bytes". If changes to binary files are mixed with changes to text files, change counts are padded to take at least three columns. And the other way around, if change counts require more than three columns, then "Bin"s are padded to align with the change count. This way, the +- part starts in the same column as "XXX -> YYY" part for binary files. This makes the graph easier to parse visually thanks to the empty column. This mimics the layout of diff --stat before this change. Tests and the tutorial are updated to reflect the new --stat output. This means either the removal of extra padding and/or the addition of up to three extra characters to truncated filenames. One test is added to check the graph alignment when a binary file change and text file change of more than 999 lines are committed together. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4052: work around shells unable to set COLUMNS to 1Zbigniew Jędrzejewski-Szmek2012-04-27
| | | | | | | | | | Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Prevent graph_width of stat width from falling below minLucian Poston2012-04-18
| | | | | | | | | | | | | | Update tests in t4052 fixed by this change. Signed-off-by: Lucian Poston <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4052: Test diff-stat output with minimum columnsLucian Poston2012-04-18
| | | | | | | | | | | | | | | | | | When COLUMNS or --stat-width restricts the diff-stat width to near the minimum, 26 columns, the graph_width value becomes negative. Consequently, the graph part of diff-stat is not resized properly. Signed-off-by: Lucian Poston <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4052: Adjust --graph --stat output for prefixesLucian Poston2012-04-16
| | | | | | | | | | | | | | | | Adjust tests to verify that the commit history graph tree is taken into consideration when the diff stat output width is calculated. Signed-off-by: Lucian Poston <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4052: test --stat output with --graphZbigniew Jędrzejewski-Szmek2012-04-16
|/ | | | | | | | | | Add tests which show that the width of the --prefix added by --graph is not taken into consideration when the diff stat output width is calculated. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Lucian Poston <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: add config option to limit graph widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | | | | 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 <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: enable limiting of the graph partZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | | | | | | 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 <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: add a test for output with COLUMNS=40Zbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | 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 <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: use a maximum of 5/8 for the filename partZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | | | | | | | | | 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 t4052; 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. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | Make merge --stat behave like diff --stat and use the full terminal width. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* log --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | Make log --stat behave like diff --stat and use the full terminal width. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* show --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | Make show --stat behave like diff --stat and use the full terminal width. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --stat: tests for long filenames and big change countsJunio C Hamano2012-03-01
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 <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>