diff-tree --always flag
It _might_ make sense for certain users like gitk and gitview if we had a single tool that gives --pretty and its diff even if the diff is empty. Having said that, the flag --cc -m is too specific. If some uses want to see the commit log even for an empty diff, that flag should not be something only --cc honors. Here's an "--always" flag that does that. Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus Torvalds committed
Feb 5, 2006 at 11:42 UTC
ec0bdb6f1e8fd772ff9eb920ebcb7dd1afcaf362
1 file changed
+9
diff-tree.c
+9
@@ -10,6 +10,7 @@ static int show_empty_combined = 0;
10
static int combine_merges = 0;
11
static int dense_combined_merges = 0;
12
static int read_stdin = 0;
13
+static int always_show_header = 0;
14
15
static const char *header = NULL;
16
static const char *header_prefix = "";
@@ -93,6 +94,10 @@ static const char *generate_header(const unsigned char *commit_sha1,
94
offset += pretty_print_commit(commit_format, commit, len,
95
this_header + offset,
96
sizeof(this_header) - offset, abbrev);
97
+ if (always_show_header) {
98
+ puts(this_header);
99
+ return NULL;
100
+ }
101
return this_header;
102
}
103
@@ -262,6 +267,10 @@ int main(int argc, const char **argv)
267
no_commit_id = 1;
268
continue;
269
}
270
+ if (!strcmp(arg, "--always")) {
271
+ always_show_header = 1;
272
+ continue;
273
+ }
274
usage(diff_tree_usage);
275
}
276
if (diff_options.output_format == DIFF_FORMAT_PATCH)