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       -E     strip  out ANSI escape sequences on each line before parsing the
67              differences.  This allows diffstat to be used with colordiff.
68
69       -f format
70              specify the format of the histogram.
71
72              0  for concise, which shows only the value  and  a  single  his‐
73                 togram code for each of insert (+), delete (-) or modify (!)
74
75              1  for normal output,
76
77              2  to fill in the histogram with dots,
78
79              4  to print each value with the histogram.
80
81              Any  nonzero  value  gives a histogram.  The dots and individual
82              values can be combined, e.g., -f6 gives both.
83
84       -h     prints the usage message and exits.
85
86       -k     suppress the merging of filenames in the report.
87
88       -K     attempt to improve the annotation of "only" files by looking for
89              a  match in the resulting set of files and inferring whether the
90              file was added or removed.
91
92              This does not currently work  in  combination  with  -R  because
93              diffstat maintains only the resulting set of files.
94
95       -l     lists only the filenames.  No histogram is generated.
96
97       -m     merge  insert/delete  counts from each "chunk" of the patch file
98              to approximate a count of the modified lines.
99
100       -n number
101              specify the minimum width used for filenames.   If  you  do  not
102              specify  this, diffstat uses the length of the longest filename,
103              after stripping common prefixes.
104
105       -N number
106              specify the maximum width used for filenames.  Names longer than
107              this  limit  are  truncated  on the left.  If you do not specify
108              this, diffstat next checks the -n option.
109
110       -o file
111              redirect standard output to file.
112
113       -p number
114              override the logic that strips common pathnames, simulating  the
115              patch "-p" option.
116
117              If  you  do  not give a -p option, diffstat examines the differ‐
118              ences and strips the common prefix from the pathnames.  This  is
119              not what patch does.
120
121       -q     suppress the "0 files changed" message for empty diffs.
122
123       -r  code
124              provides  optional  rounding  of  the  data  shown in histogram,
125              rather than truncating with error adjustments.
126
127              0  is the default.  No rounding is  performed,  but  accumulated
128                 errors are added to following columns.
129
130              1  rounds the data
131
132              2  rounds  the  data and adjusts the histogram to ensure that it
133                 displays something if there are any differences even if those
134                 would normally be rounded to zero.
135
136       -R     Assume patch was created with old and new files swapped.
137
138       -s     show only the summary line, e.g., number of insertions and dele‐
139              tions.
140
141       -S source
142              this is like the -D option, but specifies a location  where  the
143              original files (before applying differences) can be found.
144
145       -t     overrides  the  histogram,  generates  output of comma separated
146              values for the number of changed lines found in the  differences
147              for each file: inserted, deleted and modified.
148
149              If  -S  or  -D  options are given, the number of unchanged lines
150              precedes the number of changes.
151
152       -T     prints the numbers that the -t option would  show,  between  the
153              pathname and histogram.
154
155              The  width of the number of changes is determined by the largest
156              value (but at least 3).  The width given in  the  -w  option  is
157              separate from the width of these numbers.
158
159       -u     suppress the sorting of filenames in the report.
160
161       -v     show  progress,  e.g.,  if  the  output is redirected to a file,
162              write progress messages to the standard error.
163
164       -V     prints the current version number and exits.
165
166       -w number
167              specify the maximum width of the histogram.  The histogram  will
168              never be shorter than 10 columns, just in case the filenames get
169              too large.
170

ENVIRONMENT

172       Diffstat runs in a POSIX environment.
173
174       You can override the compiled-in paths of programs used for decompress‐
175       ing input files by setting environment variables corresponding to their
176       name:
177
178              DIFFSTAT_BZCAT_PATH
179              DIFFSTAT_BZIP2_PATH
180              DIFFSTAT_COMPRESS_PATH
181              DIFFSTAT_GZIP_PATH
182              DIFFSTAT_LZCAT_PATH
183              DIFFSTAT_PCAT_PATH
184              DIFFSTAT_UNCOMPRESS_PATH
185              DIFFSTAT_XZ_PATH
186              DIFFSTAT_ZCAT_PATH
187
188       However, diffstat assumes that the resulting program uses the same com‐
189       mand-line options, e.g., "-c" to decompress to the standard output.
190

FILES

192       Diffstat is a single binary module, which uses no auxiliary files.
193

BUGS

195       Diffstat makes a lot of assumptions about the format of diff's output.
196
197       There is no way to obtain a filename from the standard diff between two
198       files with no options.  Context diffs work, as well as unified diffs.
199
200       There's no easy way to determine the  degree  of  overlap  between  the
201       "before"  and  "after"  displays  of  modified  lines.  diffstat simply
202       counts the number of inserted and deleted lines to approximate modified
203       lines for the -m option.
204

SEE ALSO

206       diff(1), patch(1).
207

AUTHOR

209       Thomas Dickey <dickey@invisible-island.net>.
210
211
212
213                                                                   DIFFSTAT(1)
Impressum