Skip to content

Commit 0ff5bf7

Browse files
author
Junio C Hamano
committed
Implement git-update-cache --force-remove <path>
This new flag tells git-update-cache to remove the named path even when the work tree still happens to have the file. It is used to update git-merge-one-file-script not to smudge the work tree. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 74400e7 commit 0ff5bf7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

update-cache.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,15 @@ int main(int argc, char **argv)
306306
i += 3;
307307
continue;
308308
}
309+
if (!strcmp(path, "--force-remove")) {
310+
if (argc <= i + 1)
311+
die("update-cache: --force-remove <path>");
312+
if (remove_file_from_cache(argv[i+1]))
313+
die("update-cache: --force-remove cannot remove %s", argv[i+1]);
314+
i++;
315+
continue;
316+
}
317+
309318
if (!strcmp(path, "--ignore-missing")) {
310319
not_new = 1;
311320
continue;

0 commit comments

Comments
 (0)