@matheusbsbs / matheus-bagliano / commits / a8ee75bc7a
Fork 0

Fix gitlink index entry filesystem matching

The code to match up index entries with the filesystem was stupidly broken. We shouldn't compare the filesystem stat() information with S_IFDIRLNK, since that's purely a git-internal value, and not what the filesystem uses (on the filesystem, it's just a regular directory). Also, don't bother to make the stat() time comparisons etc for DIRLNK entries in ce_match_stat_basic(), since we do an exact match for these things, and the hints in the stat data simply doesn't matter. This fixes "git status" with submodules that haven't been checked out in the supermodule. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Apr 13, 2007 at 09:24 UTC a8ee75bc7a2ddbb10e0a4303b21bb5c300f98cc2
1 file changed +4 -4
read-cache.c
+4 -4
@@ -120,9 +120,9 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
120 if (ce_compare_link(ce, xsize_t(st->st_size)))
121 return DATA_CHANGED;
122 break;
123 - case S_IFDIRLNK:
124 - /* No need to do anything, we did the exact compare in "match_stat_basic" */
125 - break;
123 + case S_IFDIR:
124 + if (S_ISDIRLNK(ntohl(ce->ce_mode)))
125 + return 0;
126 default:
127 return TYPE_CHANGED;
128 }
@@ -153,7 +153,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
153 changed |= TYPE_CHANGED;
154 else if (ce_compare_gitlink(ce))
155 changed |= DATA_CHANGED;
156 - break;
156 + return changed;
157 default:
158 die("internal error: ce_mode is %o", ntohl(ce->ce_mode));
159 }