diff options
author | Peter Baumann <Peter.B.Baumann@stud.informatik.uni-erlangen.de> | 2006-11-23 10:36:33 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-11-24 02:35:26 -0800 |
commit | 0f03ca946142bd656c1af9ff811cb9efbc8314da (patch) | |
tree | 0f3114f2afe704ea8356355debf8427af9ca68c5 /builtin-log.c | |
parent | 3fbe2d54d7d91378934df7b16d70dc5877586fae (diff) | |
download | git-0f03ca946142bd656c1af9ff811cb9efbc8314da.tar.gz |
config option log.showroot to show the diff of root commits
This allows one to see a root commit as a diff in commands like git-log,
git-show and git-whatchanged.
Signed-off-by: Peter Baumann <Peter.B.Baumannn@stud.informatik.uni-erlangen.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/builtin-log.c b/builtin-log.c index fedb0137bc..7acf5d3b0c 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -13,6 +13,8 @@ #include <time.h> #include <sys/time.h> +static int default_show_root = 1; + /* this is in builtin-diff.c */ void add_head(struct rev_info *revs); @@ -22,6 +24,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, rev->abbrev = DEFAULT_ABBREV; rev->commit_format = CMIT_FMT_DEFAULT; rev->verbose_header = 1; + rev->show_root_diff = default_show_root; argc = setup_revisions(argc, argv, rev, "HEAD"); if (rev->diffopt.pickaxe || rev->diffopt.filter) rev->always_show_header = 0; @@ -44,11 +47,20 @@ static int cmd_log_walk(struct rev_info *rev) return 0; } +static int git_log_config(const char *var, const char *value) +{ + if (!strcmp(var, "log.showroot")) { + default_show_root = git_config_bool(var, value); + return 0; + } + return git_diff_ui_config(var, value); +} + int cmd_whatchanged(int argc, const char **argv, const char *prefix) { struct rev_info rev; - git_config(git_diff_ui_config); + git_config(git_log_config); init_revisions(&rev, prefix); rev.diff = 1; rev.diffopt.recursive = 1; @@ -63,7 +75,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; - git_config(git_diff_ui_config); + git_config(git_log_config); init_revisions(&rev, prefix); rev.diff = 1; rev.diffopt.recursive = 1; @@ -80,7 +92,7 @@ int cmd_log(int argc, const char **argv, const char *prefix) { struct rev_info rev; - git_config(git_diff_ui_config); + git_config(git_log_config); init_revisions(&rev, prefix); rev.always_show_header = 1; cmd_log_init(argc, argv, prefix, &rev); @@ -109,7 +121,7 @@ static int git_format_config(const char *var, const char *value) if (!strcmp(var, "diff.color")) { return 0; } - return git_diff_ui_config(var, value); + return git_log_config(var, value); } |