aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-02-05 11:42:09 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-05 13:46:19 -0800
commitec0bdb6f1e8fd772ff9eb920ebcb7dd1afcaf362 (patch)
tree42440110d72d1df49e853ab15e3b714268701cf2
parent04fe2a1706b4bd71b604bfe7d7295064440872cf (diff)
downloadgit-ec0bdb6f1e8fd772ff9eb920ebcb7dd1afcaf362.tar.gz
git-ec0bdb6f1e8fd772ff9eb920ebcb7dd1afcaf362.tar.xz
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>
-rw-r--r--diff-tree.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/diff-tree.c b/diff-tree.c
index 6593a6920..2df23c65f 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -10,6 +10,7 @@ static int show_empty_combined = 0;
static int combine_merges = 0;
static int dense_combined_merges = 0;
static int read_stdin = 0;
+static int always_show_header = 0;
static const char *header = NULL;
static const char *header_prefix = "";
@@ -93,6 +94,10 @@ static const char *generate_header(const unsigned char *commit_sha1,
offset += pretty_print_commit(commit_format, commit, len,
this_header + offset,
sizeof(this_header) - offset, abbrev);
+ if (always_show_header) {
+ puts(this_header);
+ return NULL;
+ }
return this_header;
}
@@ -262,6 +267,10 @@ int main(int argc, const char **argv)
no_commit_id = 1;
continue;
}
+ if (!strcmp(arg, "--always")) {
+ always_show_header = 1;
+ continue;
+ }
usage(diff_tree_usage);
}
if (diff_options.output_format == DIFF_FORMAT_PATCH)