git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] whatchanged: Default to DIFF_FORMAT_RAW

From
THTimo Hirvonen <tihirvon@gmail.com>
Date
Jun 25, 2006, 12:39 UTC
Message-ID
<20060625153935.6b1e485c.tihirvon@gmail.com>
In-Reply-To
<7vy7vltppj.fsf@assigned-by-dhcp.cox.net>

Split cmd_log_wc() to cmd_log_init() and cmd_log_walk() and set default diff output format for whatchanged to DIFF_FORMAT_RAW.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
---
  Forget the previous patch, this is cleaner.
 builtin-log.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 5b3fadc..28cd8bf 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -14,22 +14,22 @@ #include "builtin.h"
 /* this is in builtin-diff.c */
 void add_head(struct rev_info *revs);
 
-static int cmd_log_wc(int argc, const char **argv, char **envp,
+static void cmd_log_init(int argc, const char **argv, char **envp,
 		      struct rev_info *rev)
 {
-	struct commit *commit;
-
 	rev->abbrev = DEFAULT_ABBREV;
 	rev->commit_format = CMIT_FMT_DEFAULT;
 	rev->verbose_header = 1;
 	argc = setup_revisions(argc, argv, rev, "HEAD");
-	if (rev->always_show_header) {
-		if (rev->diffopt.pickaxe || rev->diffopt.filter)
-			rev->always_show_header = 0;
-	}
-
+	if (rev->diffopt.pickaxe || rev->diffopt.filter)
+		rev->always_show_header = 0;
 	if (argc > 1)
 		die("unrecognized argument: %s", argv[1]);
+}
+
+static int cmd_log_walk(struct rev_info *rev)
+{
+	struct commit *commit;
 
 	prepare_revision_walk(rev);
 	setup_pager();
@@ -51,7 +51,10 @@ int cmd_whatchanged(int argc, const char
 	rev.diff = 1;
 	rev.diffopt.recursive = 1;
 	rev.simplify_history = 0;
-	return cmd_log_wc(argc, argv, envp, &rev);
+	cmd_log_init(argc, argv, envp, &rev);
+	if (!rev.diffopt.output_format)
+		rev.diffopt.output_format = DIFF_FORMAT_RAW;
+	return cmd_log_walk(&rev);
 }
 
 int cmd_show(int argc, const char **argv, char **envp)
@@ -66,7 +69,8 @@ int cmd_show(int argc, const char **argv
 	rev.always_show_header = 1;
 	rev.ignore_merges = 0;
 	rev.no_walk = 1;
-	return cmd_log_wc(argc, argv, envp, &rev);
+	cmd_log_init(argc, argv, envp, &rev);
+	return cmd_log_walk(&rev);
 }
 
 int cmd_log(int argc, const char **argv, char **envp)
@@ -76,7 +80,8 @@ int cmd_log(int argc, const char **argv,
 	init_revisions(&rev);
 	rev.always_show_header = 1;
 	rev.diffopt.recursive = 1;
-	return cmd_log_wc(argc, argv, envp, &rev);
+	cmd_log_init(argc, argv, envp, &rev);
+	return cmd_log_walk(&rev);
 }
 
 static int istitlechar(char c)
-- 
1.4.1.rc1.g39849-dirty
Previous: Junio C HamanoNext: Timo Hirvonen
Message 11 of 20 in “Rework diff options”
  1. 0/7 Rework diff optionsTimo Hirvonen, Jun 24, 2006
  2. 1/7 Clean up diff.cTimo Hirvonen, Jun 24, 2006
  3. 2/7 Merge with_raw, with_stat and summary variables to output_formatTimo Hirvonen, Jun 24, 2006
  4. Johannes SchindelinJun 24, 2006
  5. Timo HirvonenJun 24, 2006
  6. Johannes SchindelinJun 24, 2006
  7. Add msg_sep to diff_optionsTimo Hirvonen, Jun 25, 2006
  8. Junio C HamanoJun 25, 2006
  9. whatchanged: Default to DIFF_FORMAT_RAWTimo Hirvonen, Jun 25, 2006
  10. Junio C HamanoJun 25, 2006
  11. whatchanged: Default to DIFF_FORMAT_RAWTimo Hirvonen, Jun 25, 2006
  12. Don't xcalloc() struct diffstat_tTimo Hirvonen, Jun 25, 2006
  13. 3/7 Make --raw option available for all diff commandsTimo Hirvonen, Jun 24, 2006
  14. 4/7 Set default diff output format after parsing command lineTimo Hirvonen, Jun 24, 2006
  15. 5/7 DIFF_FORMAT_RAW is not default anymoreTimo Hirvonen, Jun 24, 2006
  16. 6/7 --name-only, --name-status, --check and -s are mutually exclusiveTimo Hirvonen, Jun 24, 2006
  17. 7/7 Remove awkward compatibility wartsTimo Hirvonen, Jun 24, 2006
  18. Junio C HamanoJun 25, 2006
  19. Timo HirvonenJun 25, 2006
  20. Junio C HamanoJun 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.