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       -D destination
50              specify a directory containing files which can be referred to as
51              the result of applying the differences.  diffstat will count the
52              lines in the corresponding files (after adjusting the  names  by
53              the -p option) to obtain the total number of lines in each file.
54
55              The  remainder, after subtracting modified and deleted lines, is
56              shown as "unchanged lines".
57
58       -e file
59              redirect standard error to file.
60
61       -f format
62              specify the format of the histogram.
63
64              0  for concise, which shows only the value  and  a  single  his‐
65                 togram code for each of insert (+), delete (-) or modify (!)
66
67              1  for normal output,
68
69              2  to fill in the histogram with dots,
70
71              4  to print each value with the histogram.
72
73              Any  nonzero  value  gives a histogram.  The dots and individual
74              values can be combined, e.g., -f6 gives both.
75
76       -h     prints the usage message and exits.
77
78       -k     suppress the merging of filenames in the report.
79
80       -l     lists only the filenames.  No histogram is generated.
81
82       -m     merge insert/delete counts from each "chunk" of the  patch  file
83              to approximate a count of the modified lines.
84
85       -n number
86              specify  the  minimum  width  used for filenames.  If you do not
87              specify this, diffstat uses the length of the longest  filename,
88              after stripping common prefixes.
89
90       -N number
91              specify the maximum width used for filenames.  Names longer than
92              this limit are truncated on the left.  If  you  do  not  specify
93              this, diffstat next checks the -n option.
94
95       -o file
96              redirect standard output to file.
97
98       -p number
99              override  the logic that strips common pathnames, simulating the
100              patch "-p" option.
101
102       -q     suppress the "0 files changed" message for empty diffs.
103
104       -r  code
105              provides optional rounding  of  the  data  shown  in  histogram,
106              rather than truncating with error adjustments.
107
108              0  is  the  default.   No rounding is performed, but accumulated
109                 errors are added to following columns.
110
111              1  rounds the data
112
113              2  rounds the data and adjusts the histogram to ensure  that  it
114                 displays something if there are any differences even if those
115                 would normally be rounded to zero.
116
117       -S source
118              this is like the -D option, but specifies a location  where  the
119              original files (before applying differences) can be found.
120
121       -t     overrides  the  histogram,  generates  output of comma separated
122              values.
123
124       -u     suppress the sorting of filenames in the report.
125
126       -v     show progress, e.g., if the output  is  redirected  to  a  file,
127              write progress messages to the standard error.
128
129       -V     prints the current version number and exits.
130
131       -w number
132              specify  the maximum width of the histogram.  The histogram will
133              never be shorter than 10 columns, just in case the filenames get
134              too large.
135

ENVIRONMENT

137       Diffstat runs in a portable UNIX® environment.
138
139       You can override the compiled-in paths of programs used for decompress‐
140       ing input files by setting environment variables corresponding to their
141       name:
142
143              DIFFSTAT_BZCAT_PATH
144              DIFFSTAT_BZIP2_PATH
145              DIFFSTAT_COMPRESS_PATH
146              DIFFSTAT_GZIP_PATH
147              DIFFSTAT_LZCAT_PATH
148              DIFFSTAT_PCAT_PATH
149              DIFFSTAT_UNCOMPRESS_PATH
150              DIFFSTAT_ZCAT_PATH
151
152       However, diffstat assumes that the resulting program uses the same com‐
153       mand-line options, e.g., "-c" to decompress to the standard output.
154

FILES

156       Diffstat is a single binary module, which uses no auxiliary files.
157

BUGS

159       Diffstat makes a lot of assumptions about the format of a diff file.
160
161       There is no way to obtain a filename from the standard diff between two
162       files with no options.  Context diffs work, as well as unified diffs.
163
164       There's  no  easy  way  to  determine the degree of overlap between the
165       "before" and "after"  displays  of  modified  lines.   diffstat  simply
166       counts the number of inserted and deleted lines to approximate modified
167       lines for the -m option.
168

SEE ALSO

170       diff (1).
171

AUTHOR

173       Thomas Dickey <dickey@invisible-island.net>.
174
175
176
177                                                                   DIFFSTAT(1)
Impressum