Merge branch 'mg/rebase-i-onto-reflog-in-full'
[gitweb.git] / builtin / update-index.c
index 5f038d64da38820ebaa73ff73d1082e17c3c80d2..4ce341ceebbe27cc21b0341e4a4339af84af51de 100644 (file)
@@ -95,7 +95,8 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru
        size = cache_entry_size(len);
        ce = xcalloc(1, size);
        memcpy(ce->name, path, len);
-       ce->ce_flags = len;
+       ce->ce_flags = create_ce_flags(0);
+       ce->ce_namelen = len;
        fill_stat_cache_info(ce, st);
        ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
 
@@ -211,12 +212,6 @@ static int process_path(const char *path)
        if (S_ISDIR(st.st_mode))
                return process_directory(path, len, &st);
 
-       /*
-        * Process a regular file
-        */
-       if (ce && S_ISGITLINK(ce->ce_mode))
-               return error("%s is already a gitlink, not replacing", path);
-
        return add_one_path(ce, path, len, &st);
 }
 
@@ -235,7 +230,8 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
 
        hashcpy(ce->sha1, sha1);
        memcpy(ce->name, path, len);
-       ce->ce_flags = create_ce_flags(len, stage);
+       ce->ce_flags = create_ce_flags(stage);
+       ce->ce_namelen = len;
        ce->ce_mode = create_ce_mode(mode);
        if (assume_unchanged)
                ce->ce_flags |= CE_VALID;
@@ -433,7 +429,8 @@ static struct cache_entry *read_one_ent(const char *which,
 
        hashcpy(ce->sha1, sha1);
        memcpy(ce->name, path, namelen);
-       ce->ce_flags = create_ce_flags(namelen, stage);
+       ce->ce_flags = create_ce_flags(stage);
+       ce->ce_namelen = namelen;
        ce->ce_mode = create_ce_mode(mode);
        return ce;
 }