From: Junio C Hamano Date: Mon, 13 Jun 2005 00:44:21 +0000 (-0700) Subject: [PATCH] Support commit_format in diff-tree X-Git-Tag: v0.99~291 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a8db165ee90c7a460916c3efbf97750dd019872c;p=git.git [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 Signed-off-by: Linus Torvalds --- diff --git a/diff-tree.c b/diff-tree.c index 6f8dc2024..3c8838582 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] [-O] [-m] [-s] [-v] [-t] "; +"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S] [-O] [-m] [-s] [-v] [--pretty] [-t] "; + +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;