Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff --cumulative is a sub-option of --dirstat
author
Junio C Hamano
<gitster@pobox.com>
Wed, 3 Sep 2008 00:28:59 +0000
(17:28 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 4 Sep 2008 05:37:03 +0000
(22:37 -0700)
The option used to be implemented as if it is a totally independent one,
but "git diff --cumulative" would not mean anything without "--dirstat".
This makes --cumulative imply --dirstat.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
patch
|
blob
|
history
diff.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
ff2549d
)
diff --git
a/diff.c
b/diff.c
index 7b4300a74ab116bdf96ef015322a7533204fd18f..b3a7da70a59788f8edf5983e8e0b4629ea56db20 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-1072,7
+1072,7
@@
static void show_dirstat(struct diff_options *options)
dir.alloc = 0;
dir.nr = 0;
dir.percent = options->dirstat_percent;
dir.alloc = 0;
dir.nr = 0;
dir.percent = options->dirstat_percent;
- dir.cumulative =
options->output_format & DIFF_FORMAT_CUMULATIVE
;
+ dir.cumulative =
DIFF_OPT_TST(options, DIRSTAT_CUMULATIVE)
;
changed = 0;
for (i = 0; i < q->nr; i++) {
changed = 0;
for (i = 0; i < q->nr; i++) {
@@
-2298,6
+2298,7
@@
void diff_setup(struct diff_options *options)
options->break_opt = -1;
options->rename_limit = -1;
options->dirstat_percent = 3;
options->break_opt = -1;
options->rename_limit = -1;
options->dirstat_percent = 3;
+ DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
options->context = 3;
options->change = diff_change;
options->context = 3;
options->change = diff_change;
@@
-2470,8
+2471,10
@@
int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->output_format |= DIFF_FORMAT_SHORTSTAT;
else if (opt_arg(arg, 'X', "dirstat", &options->dirstat_percent))
options->output_format |= DIFF_FORMAT_DIRSTAT;
options->output_format |= DIFF_FORMAT_SHORTSTAT;
else if (opt_arg(arg, 'X', "dirstat", &options->dirstat_percent))
options->output_format |= DIFF_FORMAT_DIRSTAT;
- else if (!strcmp(arg, "--cumulative"))
- options->output_format |= DIFF_FORMAT_CUMULATIVE;
+ else if (!strcmp(arg, "--cumulative")) {
+ options->output_format |= DIFF_FORMAT_DIRSTAT;
+ DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
+ }
else if (!strcmp(arg, "--check"))
options->output_format |= DIFF_FORMAT_CHECKDIFF;
else if (!strcmp(arg, "--summary"))
else if (!strcmp(arg, "--check"))
options->output_format |= DIFF_FORMAT_CHECKDIFF;
else if (!strcmp(arg, "--summary"))
diff --git
a/diff.h
b/diff.h
index 50fb5ddb0bec02b0cd5498d6ecc37d44bf874476..7f53bebf335148a5f623b5fcbe6142e6c4b53282 100644
(file)
--- a/
diff.h
+++ b/
diff.h
@@
-31,7
+31,6
@@
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
#define DIFF_FORMAT_PATCH 0x0010
#define DIFF_FORMAT_SHORTSTAT 0x0020
#define DIFF_FORMAT_DIRSTAT 0x0040
#define DIFF_FORMAT_PATCH 0x0010
#define DIFF_FORMAT_SHORTSTAT 0x0020
#define DIFF_FORMAT_DIRSTAT 0x0040
-#define DIFF_FORMAT_CUMULATIVE 0x0080
/* These override all above */
#define DIFF_FORMAT_NAME 0x0100
/* These override all above */
#define DIFF_FORMAT_NAME 0x0100
@@
-64,6
+63,7
@@
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
#define DIFF_OPT_CHECK_FAILED (1 << 16)
#define DIFF_OPT_RELATIVE_NAME (1 << 17)
#define DIFF_OPT_IGNORE_SUBMODULES (1 << 18)
#define DIFF_OPT_CHECK_FAILED (1 << 16)
#define DIFF_OPT_RELATIVE_NAME (1 << 17)
#define DIFF_OPT_IGNORE_SUBMODULES (1 << 18)
+#define DIFF_OPT_DIRSTAT_CUMULATIVE (1 << 19)
#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)
#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)