Skip to content

Commit

Permalink
update-index --unresolve: work from a subdirectory.
Browse files Browse the repository at this point in the history
It completely forgot to take the prefix into account, so you
had to feed the full path even when you start from a
subdirectory, which was nonsensical.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed May 6, 2006
1 parent 86118bc commit 09895c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ static void read_head_pointers(void)
}
}

static int do_unresolve(int ac, const char **av)
static int do_unresolve(int ac, const char **av,
const char *prefix, int prefix_length)
{
int i;
int err = 0;
Expand All @@ -588,7 +589,10 @@ static int do_unresolve(int ac, const char **av)

for (i = 1; i < ac; i++) {
const char *arg = av[i];
err |= unresolve_one(arg);
const char *p = prefix_path(prefix, prefix_length, arg);
err |= unresolve_one(p);
if (p != arg)
free((char*)p);
}
return err;
}
Expand Down Expand Up @@ -704,7 +708,8 @@ int main(int argc, const char **argv)
break;
}
if (!strcmp(path, "--unresolve")) {
has_errors = do_unresolve(argc - i, argv + i);
has_errors = do_unresolve(argc - i, argv + i,
prefix, prefix_length);
if (has_errors)
active_cache_changed = 0;
goto finish;
Expand Down

0 comments on commit 09895c1

Please sign in to comment.