提交 f83eafdd 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

update-index: fix worktree setup

Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b6469a81
...@@ -614,10 +614,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) ...@@ -614,10 +614,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
continue; continue;
} }
if (!strcmp(path, "--refresh")) { if (!strcmp(path, "--refresh")) {
setup_work_tree();
has_errors |= refresh_cache(refresh_flags); has_errors |= refresh_cache(refresh_flags);
continue; continue;
} }
if (!strcmp(path, "--really-refresh")) { if (!strcmp(path, "--really-refresh")) {
setup_work_tree();
has_errors |= refresh_cache(REFRESH_REALLY | refresh_flags); has_errors |= refresh_cache(REFRESH_REALLY | refresh_flags);
continue; continue;
} }
...@@ -684,6 +686,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) ...@@ -684,6 +686,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
goto finish; goto finish;
} }
if (!strcmp(path, "--again") || !strcmp(path, "-g")) { if (!strcmp(path, "--again") || !strcmp(path, "-g")) {
setup_work_tree();
has_errors = do_reupdate(argc - i, argv + i, has_errors = do_reupdate(argc - i, argv + i,
prefix, prefix_length); prefix, prefix_length);
if (has_errors) if (has_errors)
...@@ -702,6 +705,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) ...@@ -702,6 +705,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
usage(update_index_usage); usage(update_index_usage);
die("unknown option %s", path); die("unknown option %s", path);
} }
setup_work_tree();
p = prefix_path(prefix, prefix_length, path); p = prefix_path(prefix, prefix_length, path);
update_one(p, NULL, 0); update_one(p, NULL, 0);
if (set_executable_bit) if (set_executable_bit)
...@@ -714,6 +718,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) ...@@ -714,6 +718,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
strbuf_init(&buf, 0); strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0); strbuf_init(&nbuf, 0);
setup_work_tree();
while (strbuf_getline(&buf, stdin, line_termination) != EOF) { while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
const char *p; const char *p;
if (line_termination && buf.buf[0] == '"') { if (line_termination && buf.buf[0] == '"') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册