Code

gitweb: Lift any characters restriction on searched strings
[git.git] / builtin-add.c
index 82c806acf003e04f2435477eb4624eb72fe4fb32..b08e68831a3d3b5ff91e679b4e1862bf65f22bff 100644 (file)
@@ -14,7 +14,7 @@
 #include "revision.h"
 
 static const char builtin_add_usage[] =
-"git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--] <filepattern>...";
+"git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--refresh] [--] <filepattern>...";
 
 static int take_worktree_changes;
 static const char *excludes_file;
@@ -102,6 +102,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;
@@ -109,12 +110,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;
@@ -216,7 +217,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;
        }