aboutsummaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-04-16 15:17:23 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-16 15:34:37 -0700
commit78fff6ebbafe2d23464a2b059104954bfe8732c7 (patch)
treebc5881117b11df701c08ea2ccb9d195a004d2a49 /log-tree.c
parentcb8f64b4e3f263c113b7a2f156af74b810e969ff (diff)
downloadgit-78fff6ebbafe2d23464a2b059104954bfe8732c7.tar.gz
git-78fff6ebbafe2d23464a2b059104954bfe8732c7.tar.xz
Fixes for option parsing
Make sure "git show" always show the header, regardless of whether there is a diff or not. Also, make sure "always_show_header" actually works, since generate_header only tested it in one out of three return paths. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/log-tree.c b/log-tree.c
index 7d9f41ede..af36f702e 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -43,7 +43,7 @@ static int diff_root_tree(struct rev_info *opt,
return retval;
}
-static const char *generate_header(struct rev_info *opt,
+static const char *get_header(struct rev_info *opt,
const unsigned char *commit_sha1,
const unsigned char *parent_sha1,
const struct commit *commit)
@@ -75,11 +75,21 @@ static const char *generate_header(struct rev_info *opt,
offset += pretty_print_commit(opt->commit_format, commit, len,
this_header + offset,
sizeof(this_header) - offset, abbrev);
+ return this_header;
+}
+
+static const char *generate_header(struct rev_info *opt,
+ const unsigned char *commit_sha1,
+ const unsigned char *parent_sha1,
+ const struct commit *commit)
+{
+ const char *header = get_header(opt, commit_sha1, parent_sha1, commit);
+
if (opt->always_show_header) {
- puts(this_header);
- return NULL;
+ puts(header);
+ header = NULL;
}
- return this_header;
+ return header;
}
static int do_diff_combined(struct rev_info *opt, struct commit *commit)