From 4d1012c3709e356107d0fb0e3bf5a39e0d5c209d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 11 Nov 2007 23:35:23 +0000 Subject: Fix rev-list when showing objects involving submodules The function mark_tree_uninteresting() assumed that the tree entries are blob when they are not trees. This is not so. Since we do not traverse into submodules (yet), the gitlinks should be ignored. In general, we should try to start moving away from using the "S_ISLNK()" like things for internal git state. It was a mistake to just assume the numbers all were same across all systems in the first place. This implementation converts to the "object_type", and then uses a case statement. Noticed by Ilari on IRC. Test script taken from an earlier version by Dscho. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- revision.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index e76da0d44..e8650c35a 100644 --- a/revision.c +++ b/revision.c @@ -65,10 +65,17 @@ void mark_tree_uninteresting(struct tree *tree) init_tree_desc(&desc, tree->buffer, tree->size); while (tree_entry(&desc, &entry)) { - if (S_ISDIR(entry.mode)) + switch (object_type(entry.mode)) { + case OBJ_TREE: mark_tree_uninteresting(lookup_tree(entry.sha1)); - else + break; + case OBJ_BLOB: mark_blob_uninteresting(lookup_blob(entry.sha1)); + break; + default: + /* Subproject commit - not in this repository */ + break; + } } /* -- cgit v1.2.1