Reputation: 29066
I noticed that if you do
$ git diff -M --stat
out_of_the_water/out_of_itself => he_watches_my_gauze_dress/blowing_on_the_line | 0
1 file changed, 0 insertions(+), 0 deletions(-)
or
$ git diff -M --stat | cat
.../out_of_itself => he_watches_my_gauze_dress/blowing_on_the_line | 0
1 file changed, 0 insertions(+), 0 deletions(-)
The output is different and the first filename is truncated. This is a problem in my case because I want to isolate both filenames:
$ git diff -M head~1 --stat | perl -ne 'print "$1 $2" if m/^\s*(.*?) => (.*?) \|/'
How to configure git to give the same output if piped into another process?
Upvotes: 2
Views: 269
Reputation: 38619
I am tempted to say RTFM, but for your benefit, I'll quote the relevant part here:
--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 overridden 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 settingdiff.statGraphWidth=<width>
(does not affectgit format-patch
). By giving a third parameter<count>
, you can limit the 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>
.
So without piping, the width is your terminal width, which is wider than 80 characters; with piping there is no terminal width and thus the width is 80. So just use --stat=99999
and nothing should get abbreviated.
Upvotes: 2