summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Linus Torvalds <torvalds@osdl.org>2006-05-03 07:59:00 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-03 14:19:02 -0700
commitc8c893c62b0d9997e7dfe7bd5f636ddbf29ef619 (patch)
tree1f187349eec518c7afb22469e7d203707794708b
parentadd documentation for update-index --unresolve (diff)
downloadtgif-c8c893c62b0d9997e7dfe7bd5f636ddbf29ef619.tar.xz
Fix "git-log --parents" breakage post v1.3.0
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>
-rw-r--r--log-tree.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/log-tree.c b/log-tree.c
index 9634c4677f..b90ba6762a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -3,6 +3,15 @@
#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];
@@ -14,7 +23,10 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
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;
}
@@ -40,7 +52,9 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
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');