Thread (18 messages) flat view 18 messages, 4 authors, 2016-06-15

Re: git-rev-list: add "--dense" flag

From: Jonas Fonseca <hidden>
Date: 2016-06-15 22:42:09
Subsystem: the rest · Maintainer: Linus Torvalds

Linus Torvalds [off-list ref] wrote Tue, Oct 25, 2005:
On Tue, 25 Oct 2005, Jonas Fonseca wrote:
quoted
Is the initial commit supposed to be listed when the file has been added
later?
Right now --dense will _always_ show the root commit. I didn't do the 
logic that does the diff against an empty tree. I was lazy.

This patch does that, and may or may not work.
Without the workaround below it segfaults.
Does this match what you expected?
Yes, thanks.
diff --git a/rev-list.c b/rev-list.c
index 5f125fd..82ec656 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -87,6 +87,7 @@ static void rewrite_one(struct commit **
 		struct commit *p = *pp;
 		if (p->object.flags & (TREECHANGE | UNINTERESTING))
 			return;
+		if (!p->parents) return;
 		/* Only single-parent commits don't have TREECHANGE */
 		*pp = p->parents->item;
 	}

-- 
Jonas Fonseca
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help