Replace a pair of patches with updated ones for subproject support.
authorJunio C Hamano <junkio@cox.net>
Sat, 14 Apr 2007 10:21:56 +0000 (03:21 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 14 Apr 2007 10:24:30 +0000 (03:24 -0700)
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.

entry.c
read-cache.c
diff --git a/entry.c b/entry.c
index 9545e895d001db8a011432bcfc2f579152258d4a..50ffae40c76478a10d1c3fc9623105e7f14f863e 100644 (file)
--- 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);
index e4c628f9275abe5b87d5c2000bec323397191586..d2f332a6222cc3543bde8fa661c54c5c904cf561 100644 (file)
@@ -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));
        }