git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-log --parents broken post v1.3.0

From
Linus Torvalds <torvalds@osdl.org>
Date
May 3, 2006, 14:59 UTC
Message-ID
<Pine.LNX.4.64.0605030745550.4086@g5.osdl.org>
In-Reply-To
<46a038f90605030510x6d582804w6c0d2fec60bd56e5@mail.gmail.com>
On Thu, 4 May 2006, Martin Langhoff wrote:
Show 5 quoted lines
> On 5/3/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> > Soon after v1.3.0 git-log --parents got broken. When using --parents,
> 
> Ok -- perhaps that was a bit of a rushed statement. Reading back on
> the archives, it seems like it may have been intentional.
No it wasn't. "git log --parents" was definitely supposed to still work. 

That said, I suspect a git-cvsserver kind of usage is better off using "git-rev-list --parents HEAD" instead, which didn't break in the first place.

Show 5 quoted lines
> I have to confess, I don't quite follow the changes happening in that
> series of commits. If --parents is really not coming back I'll change
> the log entry parsing in cvsserver. However, I suspect git-log should
> error out on it ("fatal: deprecated option") so porcelains break
> explicitly, rather than silently.

No, the option really isn't deprecated, it was just missed because nothing seemed to use it.. How about this diff?

Signed-off-by: Yadda yadda
		Linus
---
diff --git a/log-tree.c b/log-tree.c
index 9634c46..f9c6f7c 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -3,6 +3,15 @@ #include "diff.h"
 #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, stru
 
 	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,6 +52,8 @@ void show_log(struct rev_info *opt, stru
 	printf("%s%s",
 		opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
 		diff_unique_abbrev(commit->object.sha1, abbrev_commit));
+	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');
Previous: Martin LanghoffNext: Martin Langhoff
Message 3 of 5 in “git-log --parents broken post v1.3.0”
  1. Martin LanghoffMay 3, 2006
  2. Martin LanghoffMay 3, 2006
  3. Linus TorvaldsMay 3, 2006
  4. Martin LanghoffMay 3, 2006
  5. cvsserver: use git-rev-list instead of git-logMartin Langhoff, May 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.