update-index: fix worktree setup
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 30, 2008 at 16:13 UTC
f83eafdd6251af29e259da8becb7610da9f3e933
1 file changed
+5
builtin-update-index.c
+5
@@ -614,10 +614,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
614
continue;
615
}
616
if (!strcmp(path, "--refresh")) {
617
+ setup_work_tree();
618
has_errors |= refresh_cache(refresh_flags);
619
continue;
620
}
621
if (!strcmp(path, "--really-refresh")) {
622
+ setup_work_tree();
623
has_errors |= refresh_cache(REFRESH_REALLY | refresh_flags);
624
continue;
625
}
@@ -684,6 +686,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
686
goto finish;
687
}
688
if (!strcmp(path, "--again") || !strcmp(path, "-g")) {
689
+ setup_work_tree();
690
has_errors = do_reupdate(argc - i, argv + i,
691
prefix, prefix_length);
692
if (has_errors)
@@ -702,6 +705,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
705
usage(update_index_usage);
706
die("unknown option %s", path);
707
}
708
+ setup_work_tree();
709
p = prefix_path(prefix, prefix_length, path);
710
update_one(p, NULL, 0);
711
if (set_executable_bit)
@@ -714,6 +718,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
718
719
strbuf_init(&buf, 0);
720
strbuf_init(&nbuf, 0);
721
+ setup_work_tree();
722
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
723
const char *p;
724
if (line_termination && buf.buf[0] == '"') {