Skip to content

Commit

Permalink
update-index: fix worktree setup
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Aug 31, 2008
1 parent b6469a8 commit f83eafd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin-update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(path, "--refresh")) {
setup_work_tree();
has_errors |= refresh_cache(refresh_flags);
continue;
}
if (!strcmp(path, "--really-refresh")) {
setup_work_tree();
has_errors |= refresh_cache(REFRESH_REALLY | refresh_flags);
continue;
}
Expand Down Expand Up @@ -684,6 +686,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
goto finish;
}
if (!strcmp(path, "--again") || !strcmp(path, "-g")) {
setup_work_tree();
has_errors = do_reupdate(argc - i, argv + i,
prefix, prefix_length);
if (has_errors)
Expand All @@ -702,6 +705,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
usage(update_index_usage);
die("unknown option %s", path);
}
setup_work_tree();
p = prefix_path(prefix, prefix_length, path);
update_one(p, NULL, 0);
if (set_executable_bit)
Expand All @@ -714,6 +718,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)

strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0);
setup_work_tree();
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
const char *p;
if (line_termination && buf.buf[0] == '"') {
Expand Down

0 comments on commit f83eafd

Please sign in to comment.