summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 060729d)
raw | patch | inline | side by side (parent: 060729d)
author | Linus Torvalds <torvalds@osdl.org> | |
Wed, 3 May 2006 14:59:00 +0000 (07:59 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 3 May 2006 21:19:02 +0000 (14:19 -0700) |
Post 1.3.0 "git log" forgets to list parent commits on the first line
when --parents is given. git-cvsserver relied on it.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
when --parents is given. git-cvsserver relied on it.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
log-tree.c | patch | blob | history |
diff --git a/log-tree.c b/log-tree.c
index 9634c4677f84e7d88965b47b5af32f23668b2142..b90ba6762ad0aa469a19c42cf8d53f7a79db02d5 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
#include "commit.h"
#include "log-tree.h"
+static void show_parents(struct commit *commit, int abbrev)
+{
+ struct commit_list *p;
+ for (p = commit->parents; p ; p = p->next) {
+ struct commit *parent = p->item;
+ printf(" %s", diff_unique_abbrev(parent->object.sha1, abbrev));
+ }
+}
+
void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
{
static char this_header[16384];
opt->loginfo = NULL;
if (!opt->verbose_header) {
- puts(sha1_to_hex(commit->object.sha1));
+ fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
+ if (opt->parents)
+ show_parents(commit, abbrev_commit);
+ putchar('\n');
return;
}
printf("%s%s",
opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
diff_unique_abbrev(commit->object.sha1, abbrev_commit));
- if (parent)
+ if (opt->parents)
+ show_parents(commit, abbrev_commit);
+ if (parent)
printf(" (from %s)", diff_unique_abbrev(parent->object.sha1, abbrev_commit));
putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');