From c6744349df5089133b7662e67aba28282b6a963f Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:21:53 +0300 Subject: Merge with_raw, with_stat and summary variables to output_format DIFF_FORMAT_* are now bit-flags instead of enumerated values. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index 44d2d136f5..e321959c56 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -176,11 +176,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.commit_format = CMIT_FMT_EMAIL; rev.verbose_header = 1; rev.diff = 1; - rev.diffopt.with_raw = 0; - rev.diffopt.with_stat = 1; rev.combine_merges = 0; rev.ignore_merges = 1; - rev.diffopt.output_format = DIFF_FORMAT_PATCH; + rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; git_config(git_format_config); rev.extra_headers = extra_headers; -- cgit v1.2.3 From c9b5ef998a3027d9f11b0820bb13896096833ccb Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:24:14 +0300 Subject: Set default diff output format after parsing command line Initialize output_format to 0 instead of DIFF_FORMAT_RAW so that we can see later if any command line options changed it. Default value is set only if output format was not specified. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index e321959c56..c1bf9d4ee1 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -178,7 +178,6 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; - rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; git_config(git_format_config); rev.extra_headers = extra_headers; @@ -247,6 +246,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp) if (argc > 1) die ("unrecognized argument: %s", argv[1]); + if (!rev.diffopt.output_format) + rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; + if (output_directory) { if (use_stdout) die("standard output, or directory, which one?"); -- cgit v1.2.3 From 0e677e1a6b0d1c0e848ed19d18dda1c3c797c75e Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:25:08 +0300 Subject: DIFF_FORMAT_RAW is not default anymore diff_setup() used to initialize output_format to DIFF_FORMAT_RAW. Now the default is 0 (no output) so don't compare against DIFF_FORMAT_RAW to see if any diff format command line flags were given. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index c1bf9d4ee1..4e5273aecf 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -24,11 +24,8 @@ static int cmd_log_wc(int argc, const char **argv, char **envp, rev->verbose_header = 1; argc = setup_revisions(argc, argv, rev, "HEAD"); if (rev->always_show_header) { - if (rev->diffopt.pickaxe || rev->diffopt.filter) { + if (rev->diffopt.pickaxe || rev->diffopt.filter) rev->always_show_header = 0; - if (rev->diffopt.output_format == DIFF_FORMAT_RAW) - rev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT; - } } if (argc > 1) -- cgit v1.2.3 From 39bc9a6c2051a9fc31dc9b34b40bdd3dd94a8afb Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sun, 25 Jun 2006 13:54:14 +0300 Subject: Add msg_sep to diff_options Add msg_sep variable to struct diff_options. msg_sep is printed after commit message. Default is "\n", format-patch sets it to "---\n". This also removes the second argument from show_log() because all callers derived it from the first argument: show_log(rev, rev->loginfo, ... Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index 4e5273aecf..71ae6c98a5 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -175,6 +175,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; + rev.diffopt.msg_sep = "---\n"; git_config(git_format_config); rev.extra_headers = extra_headers; -- cgit v1.2.3 From 9dafea267806988d7f5821780de688ca84766a40 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sun, 25 Jun 2006 15:39:35 +0300 Subject: whatchanged: Default to DIFF_FORMAT_RAW 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 Signed-off-by: Junio C Hamano --- builtin-log.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index 71ae6c98a5..3b7574f6d6 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -14,22 +14,22 @@ /* 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 **argv, char **envp) 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, char **envp) 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, char **envp) 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) -- cgit v1.2.3 From 17985627455901b6ae3a471b67d46239463cebb5 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Tue, 27 Jun 2006 16:27:51 +0300 Subject: log --raw: Don't descend into subdirectories by default Only do so when -r is given. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 1 - 1 file changed, 1 deletion(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index 3b7574f6d6..debddb97a0 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -79,7 +79,6 @@ int cmd_log(int argc, const char **argv, char **envp) init_revisions(&rev); rev.always_show_header = 1; - rev.diffopt.recursive = 1; cmd_log_init(argc, argv, envp, &rev); return cmd_log_walk(&rev); } -- cgit v1.2.3 From 27e1b127f32640bea68b84e0ff57d640fd31cc92 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 29 Jun 2006 00:18:52 -0700 Subject: format-patch: fix diff format option implementation The updates forgot to make the diff go recursive. --- builtin-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin-log.c') diff --git a/builtin-log.c b/builtin-log.c index debddb97a0..bcd4e5e161 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -179,7 +179,8 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; - rev.diffopt.msg_sep = "---\n"; + rev.diffopt.msg_sep = ""; + rev.diffopt.recursive = 1; git_config(git_format_config); rev.extra_headers = extra_headers; -- cgit v1.2.3