summaryrefslogtreecommitdiff
path: root/builtin-fsck.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-04-10 04:15:29 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-10 20:46:58 (GMT)
commit8d9721c86b0169c282ad1c5528317eafeb7fb0f7 (patch)
treecbf3c5aa5deaa1f8fb07961c8bcebf90d41382fe /builtin-fsck.c
parent9eec4795d44439cd170fb52c73827c728252648d (diff)
downloadgit-8d9721c86b0169c282ad1c5528317eafeb7fb0f7.zip
git-8d9721c86b0169c282ad1c5528317eafeb7fb0f7.tar.gz
git-8d9721c86b0169c282ad1c5528317eafeb7fb0f7.tar.bz2
Teach "fsck" not to follow subproject links
Since the subprojects don't necessarily even exist in the current tree, much less in the current git repository (they are totally independent repositories), we do not want to try to follow the chain from one git repository to another through a gitlink. This involves teaching fsck to ignore references to gitlink objects from a tree and from the current index. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-fsck.c')
-rw-r--r--builtin-fsck.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 4d8b66c..f22de8d 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -253,6 +253,7 @@ static int fsck_tree(struct tree *item)
case S_IFREG | 0644:
case S_IFLNK:
case S_IFDIR:
+ case S_IFDIRLNK:
break;
/*
* This is nonstandard, but we had a few of these
@@ -695,8 +696,14 @@ int cmd_fsck(int argc, char **argv, const char *prefix)
int i;
read_cache();
for (i = 0; i < active_nr; i++) {
- struct blob *blob = lookup_blob(active_cache[i]->sha1);
+ unsigned int mode;
+ struct blob *blob;
struct object *obj;
+
+ mode = ntohl(active_cache[i]->ce_mode);
+ if (S_ISDIRLNK(mode))
+ continue;
+ blob = lookup_blob(active_cache[i]->sha1);
if (!blob)
continue;
obj = &blob->object;