X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=inline;f=builtin-add.c;h=f9a65803d8dcbb9ae7eb3a3c61d8ac345b84d1cd;hb=b4833a2c62578bdbfd300e296702214cb1b9a601;hp=3d8b8b4f89514e0a8f7af1c2c7dc2f8ae372129e;hpb=43b98acc23306fd7fff888477937063361a09593;p=git.git diff --git a/builtin-add.c b/builtin-add.c index 3d8b8b4f8..f9a65803d 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -71,12 +71,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); @@ -103,7 +99,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;