]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-add.c
Merge branch 'maint'
[git.git] / builtin-add.c
index 373f87f9f296917a8d72c93307f2bb94813b6911..b8e6094b21599051c543b1f77c991363d9dfe181 100644 (file)
@@ -72,12 +72,8 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,
        baselen = common_prefix(pathspec);
        path = ".";
        base = "";
-       if (baselen) {
-               char *common = xmalloc(baselen + 1);
-               memcpy(common, *pathspec, baselen);
-               common[baselen] = 0;
-               path = base = common;
-       }
+       if (baselen)
+               path = base = xmemdupz(*pathspec, baselen);
 
        /* Read the directory and prune it */
        read_directory(dir, path, base, baselen, pathspec);
@@ -104,7 +100,6 @@ static void update_callback(struct diff_queue_struct *q,
                        break;
                case DIFF_STATUS_DELETED:
                        remove_file_from_cache(path);
-                       cache_tree_invalidate_path(active_cache_tree, path);
                        if (verbose)
                                printf("remove '%s'\n", path);
                        break;