summaryrefslogtreecommitdiff
path: root/diff-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-12 17:44:21 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-12 20:29:31 -0700
commita8db165ee90c7a460916c3efbf97750dd019872c (patch)
treedf70b4ff3b4fa5fb8680beb03df4d635ddd18d89 /diff-tree.c
parentdc7090efbc8280e482a6b2dc7419e525cbc3c5d7 (diff)
downloadgit-a8db165ee90c7a460916c3efbf97750dd019872c.tar.gz
[PATCH] Support commit_format in diff-tree
This steals --pretty command line option from rev-list and teaches diff-tree to do the same. With this change, $ git-whatchanged --pretty would work as expected. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-tree.c')
-rw-r--r--diff-tree.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/diff-tree.c b/diff-tree.c
index 6f8dc2024c..3c8838582f 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -398,7 +398,20 @@ static int diff_tree_stdin(char *line)
}
static char *diff_tree_usage =
-"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish>";
+"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [-m] [-s] [-v] [--pretty] [-t] <tree-ish> <tree-ish>";
+
+static enum cmit_fmt get_commit_format(const char *arg)
+{
+ if (!*arg)
+ return CMIT_FMT_DEFAULT;
+ if (!strcmp(arg, "=raw"))
+ return CMIT_FMT_RAW;
+ if (!strcmp(arg, "=medium"))
+ return CMIT_FMT_MEDIUM;
+ if (!strcmp(arg, "=short"))
+ return CMIT_FMT_SHORT;
+ usage(diff_tree_usage);
+}
int main(int argc, const char **argv)
{
@@ -492,6 +505,11 @@ int main(int argc, const char **argv)
header_prefix = "diff-tree ";
continue;
}
+ if (!strncmp(arg, "--pretty", 8)) {
+ verbose_header = 1;
+ commit_format = get_commit_format(arg+8);
+ continue;
+ }
if (!strcmp(arg, "--stdin")) {
read_stdin = 1;
continue;