summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80d12c2)
raw | patch | inline | side by side (parent: 80d12c2)
author | Heikki Orsila <heikki.orsila@iki.fi> | |
Fri, 5 Sep 2008 19:27:35 +0000 (22:27 +0300) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 5 Sep 2008 21:04:26 +0000 (14:04 -0700) |
This new option --dirstat-by-file is the same as --dirstat, but it
counts "impacted files" instead of "impacted lines" (lines that are
added or removed).
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
counts "impacted files" instead of "impacted lines" (lines that are
added or removed).
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/diff-options.txt | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
index 6e268326da9e34882313b7b3d094a617c3966d29..7788d4fa4a1209cbed564a20f882f0946ba400cf 100644 (file)
can be set with "--dirstat=limit". Changes in a child directory is not
counted for the parent directory, unless "--cumulative" is used.
+--dirstat-by-file[=limit]::
+ Same as --dirstat, but counts changed files instead of lines.
+
--summary::
Output a condensed summary of extended header information
such as creations, renames and mode changes.
index cbd151bbc80dbd0410f47230bbb645235131c754..2de86eb7603c1de1b5861168a7152c1f0f8cbf17 100644 (file)
--- a/diff.c
+++ b/diff.c
/*
* Original minus copied is the removed material,
* added is the new material. They are both damages
- * made to the preimage.
+ * made to the preimage. In --dirstat-by-file mode, count
+ * damaged files, not damaged lines. This is done by
+ * counting only a single damaged line per file.
*/
damage = (p->one->size - copied) + added;
+ if (DIFF_OPT_TST(options, DIRSTAT_BY_FILE) && damage > 0)
+ damage = 1;
ALLOC_GROW(dir.files, dir.nr + 1, dir.alloc);
dir.files[dir.nr].name = name;
else if (!strcmp(arg, "--cumulative")) {
options->output_format |= DIFF_FORMAT_DIRSTAT;
DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
+ } else if (opt_arg(arg, 0, "dirstat-by-file",
+ &options->dirstat_percent)) {
+ options->output_format |= DIFF_FORMAT_DIRSTAT;
+ DIFF_OPT_SET(options, DIRSTAT_BY_FILE);
}
else if (!strcmp(arg, "--check"))
options->output_format |= DIFF_FORMAT_CHECKDIFF;
index 7f53bebf335148a5f623b5fcbe6142e6c4b53282..c34688881d7ea80ecbe2ff1b3cca880f6f06f598 100644 (file)
--- a/diff.h
+++ b/diff.h
#define DIFF_OPT_RELATIVE_NAME (1 << 17)
#define DIFF_OPT_IGNORE_SUBMODULES (1 << 18)
#define DIFF_OPT_DIRSTAT_CUMULATIVE (1 << 19)
+#define DIFF_OPT_DIRSTAT_BY_FILE (1 << 20)
#define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
#define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags &= ~DIFF_OPT_##flag)