summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3fbe2d5)
raw | patch | inline | side by side (parent: 3fbe2d5)
author | Peter Baumann <Peter.B.Baumann@stud.informatik.uni-erlangen.de> | |
Thu, 23 Nov 2006 09:36:33 +0000 (10:36 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 24 Nov 2006 10:35:26 +0000 (02:35 -0800) |
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>
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>
Documentation/config.txt | patch | blob | history | |
builtin-log.c | patch | blob | history | |
t/t4013-diff-various.sh | patch | blob | history |
index 9d3c71c3b87a9603973de42c76c4570a94420398..9090762819fac988c63eaa17089c0d4c57a8d338 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
browser (and possibly at other places in the future or in other
porcelains). See e.g. gitlink:git-mailinfo[1]. Defaults to 'utf-8'.
+log.showroot::
+ If true, the initial commit will be shown as a big creation event.
+ This is equivalent to a diff against an empty tree.
+ Tools like gitlink:git-log[1] or gitlink:git-whatchanged[1], which
+ normally hide the root commit will now show it. True by default.
+
merge.summary::
Whether to include summaries of merged commits in newly created
merge commit messages. False by default.
diff --git a/builtin-log.c b/builtin-log.c
index fedb0137bc5e3ba50ecb90ce560ce9ce9290d8df..7acf5d3b0c3393ee700e084470824bb7fd7cf88a 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
#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);
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;
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;
{
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;
{
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);
if (!strcmp(var, "diff.color")) {
return 0;
}
- return git_diff_ui_config(var, value);
+ return git_log_config(var, value);
}
index 71c454356fbbcd5f67bdfc0b6ef7785fa8b712c1..ed37141b6e5afd8294c5961a1ab96c634a5f4a82 100755 (executable)
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
for i in 1 2; do echo $i; done >>dir/sub &&
git update-index file0 dir/sub &&
+ git repo-config log.showroot false &&
git commit --amend &&
git show-branch
'