From: Junio C Hamano Date: Sat, 14 Apr 2007 10:21:56 +0000 (-0700) Subject: Replace a pair of patches with updated ones for subproject support. X-Git-Tag: v1.5.2-rc0~19^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f9135dbcdda7319d12dfc7b5e0b86138719cd3ad?hp=9129e056fb021df45d98c9472b6029456941a508 Replace a pair of patches with updated ones for subproject support. This series of three patches is a *replacement* for the patch series of two patches (plus one-liner fixup) I sent yesterday. It fixes the issue I noted with "git status" incorrectly claiming that a non-checked out subproject wasn't clean - that was just a total thinko in the code (we were checking the filesystem mode against S_IFDIRLNK, which obviously cannot work, since S_IFDIRLINK is a git-internal state, not a filesystem state). It then re-sends the two patches on top of that, with the fix for checking out superprojects (we should *not* mess up any existing subproject directories, certainly not remove them - if we already have a directory in the place where we now want a subproject, we should leave it well alone!) The first one really is a fix, and it makes the commit commentary about a remaining bug in the patch I sent out yesterday go away. --- diff --git a/entry.c b/entry.c index 9545e895d0..50ffae40c7 100644 --- a/entry.c +++ b/entry.c @@ -195,6 +195,9 @@ int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath) */ unlink(path); if (S_ISDIR(st.st_mode)) { + /* If it is a gitlink, leave it alone! */ + if (S_ISDIRLNK(ntohl(ce->ce_mode))) + return 0; if (!state->force) return error("%s is a directory", path); remove_subtree(path); diff --git a/read-cache.c b/read-cache.c index e4c628f927..d2f332a622 100644 --- a/read-cache.c +++ b/read-cache.c @@ -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; } @@ -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)); }