summaryrefslogtreecommitdiff
path: root/tree-walk.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-11-11 23:35:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-14 11:44:22 (GMT)
commit4d1012c3709e356107d0fb0e3bf5a39e0d5c209d (patch)
tree8da53013ed0166353bca689e8814f2eb0c3eaf1a /tree-walk.h
parentfb5fd011482b5aa0b340a4a5bd9192c0efc1edb7 (diff)
downloadgit-4d1012c3709e356107d0fb0e3bf5a39e0d5c209d.zip
git-4d1012c3709e356107d0fb0e3bf5a39e0d5c209d.tar.gz
git-4d1012c3709e356107d0fb0e3bf5a39e0d5c209d.tar.bz2
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 <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-walk.h')
-rw-r--r--tree-walk.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tree-walk.h b/tree-walk.h
index db0fbdc..903a7b0 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -7,6 +7,13 @@ struct name_entry {
unsigned int mode;
};
+static inline enum object_type object_type(unsigned int mode)
+{
+ return S_ISDIR(mode) ? OBJ_TREE :
+ S_ISGITLINK(mode) ? OBJ_COMMIT :
+ OBJ_BLOB;
+}
+
struct tree_desc {
const void *buffer;
struct name_entry entry;