Skip to content

Commit

Permalink
Fix gitlink index entry filesystem matching
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Apr 14, 2007
1 parent ab22aed commit a8ee75b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
if (ce_compare_link(ce, xsize_t(st->st_size)))
return DATA_CHANGED;
break;
case S_IFDIRLNK:
/* No need to do anything, we did the exact compare in "match_stat_basic" */
break;
case S_IFDIR:
if (S_ISDIRLNK(ntohl(ce->ce_mode)))
return 0;
default:
return TYPE_CHANGED;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
changed |= TYPE_CHANGED;
else if (ce_compare_gitlink(ce))
changed |= DATA_CHANGED;
break;
return changed;
default:
die("internal error: ce_mode is %o", ntohl(ce->ce_mode));
}
Expand Down

0 comments on commit a8ee75b

Please sign in to comment.