]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-add.c
git-add -u paths... now works from subdirectory
[git.git] / builtin-add.c
index 159117106a3db52b430cb1bf82d094e54693f690..07e3ddfd0a49fd42206cf421924db17620fb690a 100644 (file)
@@ -115,6 +115,7 @@ 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;
@@ -122,12 +123,12 @@ static void update_callback(struct diff_queue_struct *q,
        }
 }
 
-static void update(int verbose, const char **files)
+static void update(int verbose, const char *prefix, const char **files)
 {
        struct rev_info rev;
-       init_revisions(&rev, "");
+       init_revisions(&rev, prefix);
        setup_revisions(0, NULL, &rev, NULL);
-       rev.prune_data = get_pathspec(rev.prefix, files);
+       rev.prune_data = get_pathspec(prefix, files);
        rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
        rev.diffopt.format_callback = update_callback;
        rev.diffopt.format_callback_data = &verbose;
@@ -208,7 +209,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        }
 
        if (take_worktree_changes) {
-               update(verbose, argv + i);
+               update(verbose, prefix, argv + i);
                goto finish;
        }