summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-08-16 04:38:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-16 04:38:38 (GMT)
commitc576304d512df18fa30b91bb3ac15478d5d4dfb1 (patch)
treea0be3b2ce5c20da4468433dfa6357c5357951e6f /builtin-add.c
parentf34f2b0b384b42f7a0d0d92966c145b05fe55217 (diff)
parentb13ef4916ac5a25cc5897f85ba0b4c5953cff609 (diff)
downloadgit-c576304d512df18fa30b91bb3ac15478d5d4dfb1.zip
git-c576304d512df18fa30b91bb3ac15478d5d4dfb1.tar.gz
git-c576304d512df18fa30b91bb3ac15478d5d4dfb1.tar.bz2
Merge branch 'maint' to sync with 1.5.2.5
* maint: GIT 1.5.2.5 git-add -u paths... now works from subdirectory Fix "git add -u" data corruption.
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 82c806a..3dd4ded 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -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;
}