1DIFFSTAT(1)                 General Commands Manual                DIFFSTAT(1)
2
3
4

NAME

6       diffstat - make histogram from diff-output
7

SYNOPSIS

9       diffstat [options] [file-specifications]
10

DESCRIPTION

12       This  program  reads the output of diff and displays a histogram of the
13       insertions, deletions, and modifications per-file.  Diffstat is a  pro‐
14       gram that is useful for reviewing large, complex patch files.  It reads
15       from one or more input files which contain output from diff,  producing
16       a histogram of the total lines changed for each file referenced.
17
18       If  the  input  filename ends with .bz2, .gz, .lzma, .z or .Z, diffstat
19       will read the uncompressed data via a pipe from the corresponding  pro‐
20       gram.   It also can infer the compression type from files piped via the
21       standard input.
22
23       Diffstat recognizes the most popular types of output from diff:
24
25              unified
26                     preferred by the patch utility.
27
28              context
29                     best for readability, but not very compact.
30
31              default
32                     not good for much, but simple to generate.
33
34       Diffstat detects the lines that are output by diff to tell which  files
35       are  compared,  and  then  counts  the markers in the first column that
36       denote the type of change (insertion, deletion or modification).  These
37       are shown in the histogram as "+", "-" and "!" characters.
38
39       If no filename is given on the command line, diffstat reads the differ‐
40       ences from the standard input.
41

OPTIONS

43       -b     ignore lines matching "Binary files XXX and YYY differ"  in  the
44              diff
45
46       -c     prefix  each  line  of output with "#", making it a comment-line
47              for shell scripts.
48
49       -C     add SGR color escape sequences to highlight the histogram.
50
51       -D destination
52              specify a directory containing files which can be referred to as
53              the result of applying the differences.  diffstat will count the
54              lines in the corresponding files (after adjusting the  names  by
55              the -p option) to obtain the total number of lines in each file.
56
57              The  remainder, after subtracting modified and deleted lines, is
58              shown as "unchanged lines".
59
60       -d     The debug prints a lot of information.  It is normally compiled-
61              in, but can be suppressed.
62
63       -e file
64              redirect standard error to file.
65
66       -f format
67              specify the format of the histogram.
68
69              0  for  concise,  which  shows  only the value and a single his‐
70                 togram code for each of insert (+), delete (-) or modify (!)
71
72              1  for normal output,
73
74              2  to fill in the histogram with dots,
75
76              4  to print each value with the histogram.
77
78              Any nonzero value gives a histogram.  The  dots  and  individual
79              values can be combined, e.g., -f6 gives both.
80
81       -h     prints the usage message and exits.
82
83       -k     suppress the merging of filenames in the report.
84
85       -K     attempt to improve the annotation of "only" files by looking for
86              a match in the resulting set of files and inferring whether  the
87              file was added or removed.
88
89              This  does  not  currently  work  in combination with -R because
90              diffstat maintains only the resulting set of files.
91
92       -l     lists only the filenames.  No histogram is generated.
93
94       -m     merge insert/delete counts from each "chunk" of the  patch  file
95              to approximate a count of the modified lines.
96
97       -n number
98              specify  the  minimum  width  used for filenames.  If you do not
99              specify this, diffstat uses the length of the longest  filename,
100              after stripping common prefixes.
101
102       -N number
103              specify the maximum width used for filenames.  Names longer than
104              this limit are truncated on the left.  If  you  do  not  specify
105              this, diffstat next checks the -n option.
106
107       -o file
108              redirect standard output to file.
109
110       -p number
111              override  the logic that strips common pathnames, simulating the
112              patch "-p" option.
113
114       -q     suppress the "0 files changed" message for empty diffs.
115
116       -r  code
117              provides optional rounding  of  the  data  shown  in  histogram,
118              rather than truncating with error adjustments.
119
120              0  is  the  default.   No rounding is performed, but accumulated
121                 errors are added to following columns.
122
123              1  rounds the data
124
125              2  rounds the data and adjusts the histogram to ensure  that  it
126                 displays something if there are any differences even if those
127                 would normally be rounded to zero.
128
129       -R     Assume patch was created with old and new files swapped.
130
131       -s     show only the summary line, e.g., number of insertions and dele‐
132              tions.
133
134       -S source
135              this  is  like the -D option, but specifies a location where the
136              original files (before applying differences) can be found.
137
138       -t     overrides the histogram, generates  output  of  comma  separated
139              values.
140
141       -u     suppress the sorting of filenames in the report.
142
143       -v     show  progress,  e.g.,  if  the  output is redirected to a file,
144              write progress messages to the standard error.
145
146       -V     prints the current version number and exits.
147
148       -w number
149              specify the maximum width of the histogram.  The histogram  will
150              never be shorter than 10 columns, just in case the filenames get
151              too large.
152

ENVIRONMENT

154       Diffstat runs in a portable UNIX® environment.
155
156       You can override the compiled-in paths of programs used for decompress‐
157       ing input files by setting environment variables corresponding to their
158       name:
159
160              DIFFSTAT_BZCAT_PATH
161              DIFFSTAT_BZIP2_PATH
162              DIFFSTAT_COMPRESS_PATH
163              DIFFSTAT_GZIP_PATH
164              DIFFSTAT_LZCAT_PATH
165              DIFFSTAT_PCAT_PATH
166              DIFFSTAT_UNCOMPRESS_PATH
167              DIFFSTAT_XZ_PATH
168              DIFFSTAT_ZCAT_PATH
169
170       However, diffstat assumes that the resulting program uses the same com‐
171       mand-line options, e.g., "-c" to decompress to the standard output.
172

FILES

174       Diffstat is a single binary module, which uses no auxiliary files.
175

BUGS

177       Diffstat makes a lot of assumptions about the format of a diff file.
178
179       There is no way to obtain a filename from the standard diff between two
180       files with no options.  Context diffs work, as well as unified diffs.
181
182       There's no easy way to determine the  degree  of  overlap  between  the
183       "before"  and  "after"  displays  of  modified  lines.  diffstat simply
184       counts the number of inserted and deleted lines to approximate modified
185       lines for the -m option.
186

SEE ALSO

188       diff(1).
189

AUTHOR

191       Thomas Dickey <dickey@invisible-island.net>.
192
193
194
195                                                                   DIFFSTAT(1)
Impressum