git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fixes for option parsing
@ 2006-04-16 22:17 Linus Torvalds
  2006-04-17  0:29 ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Linus Torvalds @ 2006-04-16 22:17 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


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>
---
diff --git a/git.c b/git.c
index c5de8d3..fc4e429 100644
--- a/git.c
+++ b/git.c
@@ -373,6 +373,7 @@ static int cmd_show(int argc, const char
 	rev.diffopt.recursive = 1;
 	rev.combine_merges = 1;
 	rev.dense_combined_merges = 1;
+	rev.always_show_header = 1;
 	rev.ignore_merges = 0;
 	rev.no_walk = 1;
 	return cmd_log_wc(argc, argv, envp, &rev);
diff --git a/log-tree.c b/log-tree.c
index 7d9f41e..81dff8f 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -43,7 +43,7 @@ static int diff_root_tree(struct rev_inf
 	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(struc
 	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)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-04-18 18:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-16 22:17 Fixes for option parsing Linus Torvalds
2006-04-17  0:29 ` Junio C Hamano
2006-04-17  2:42   ` Linus Torvalds
2006-04-17  3:03     ` Linus Torvalds
2006-04-17  3:36     ` Junio C Hamano
2006-04-17 14:51       ` Linus Torvalds
2006-04-17 18:59   ` Log message printout cleanups Linus Torvalds
2006-04-17 22:45     ` Junio C Hamano
2006-04-17 23:59       ` Linus Torvalds
2006-04-18  0:22         ` Junio C Hamano
2006-04-18  0:37           ` Junio C Hamano
2006-04-18  0:57             ` Linus Torvalds
2006-04-18  5:52               ` Junio C Hamano
2006-04-18 15:37                 ` Linus Torvalds
2006-04-18 16:06                   ` Linus Torvalds
2006-04-18 16:48                     ` Junio C Hamano
2006-04-18 18:33                     ` [PATCH] diff --stat: make sure to set recursive Junio C Hamano
2006-04-18  0:43           ` Log message printout cleanups Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).