summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-05 16:31:24 -0700
committerJunio C Hamano <junkio@cox.net>2006-07-05 16:31:24 -0700
commit0c926a3d9c34396636c2fea7a0cd5a4200ea298b (patch)
tree1d2c0c87f3f7fe20b20290970c04d7cc7d0a16d2 /builtin-log.c
parent169c2e9d1e81b3e7129248d89de160a7bb242411 (diff)
parent047fbe906b375e8a3a7564ad0e4443f62dd528a2 (diff)
downloadgit-0c926a3d9c34396636c2fea7a0cd5a4200ea298b.tar.gz
Merge branch 'th/diff'
* th/diff: builtin-diff: turn recursive on when defaulting to --patch format. t4013: note improvements brought by the new output code. t4013: add format-patch tests. format-patch: fix diff format option implementation combine-diff.c: type sanity. t4013 test updates for new output code. Fix some more diff options changes. Fix diff-tree -s log --raw: Don't descend into subdirectories by default diff-tree: Use ---\n as a message separator Print empty line between raw, stat, summary and patch t4013: add more tests around -c and --cc whatchanged: Default to DIFF_FORMAT_RAW Don't xcalloc() struct diffstat_t Add msg_sep to diff_options DIFF_FORMAT_RAW is not default anymore Set default diff output format after parsing command line Make --raw option available for all diff commands Merge with_raw, with_stat and summary variables to output_format t4013: add tests for diff/log family output options.
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/builtin-log.c b/builtin-log.c
index f9515a8a4a..864c6cd9ea 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -14,25 +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.output_format == DIFF_FORMAT_RAW)
- rev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
- }
- }
-
+ 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();
@@ -54,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)
@@ -69,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)
@@ -78,8 +79,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)
@@ -237,11 +238,10 @@ 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.msg_sep = "";
+ rev.diffopt.recursive = 1;
git_config(git_format_config);
rev.extra_headers = extra_headers;
@@ -312,6 +312,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?");