@matheusbsbs / matheus-bagliano / commits / 09895c1fa0
Fork 0

update-index --unresolve: work from a subdirectory.

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>

Junio C Hamano committed May 5, 2006 at 17:50 UTC 09895c1fa02f77acb2bde3d7e9da675eeb1271cf
1 file changed +8 -3
update-index.c
+8 -3
@@ -576,7 +576,8 @@ static void read_head_pointers(void)
576 }
577 }
578
579 -static int do_unresolve(int ac, const char **av)
579 +static int do_unresolve(int ac, const char **av,
580 + const char *prefix, int prefix_length)
581 {
582 int i;
583 int err = 0;
@@ -588,7 +589,10 @@ static int do_unresolve(int ac, const char **av)
589
590 for (i = 1; i < ac; i++) {
591 const char *arg = av[i];
591 - err |= unresolve_one(arg);
592 + const char *p = prefix_path(prefix, prefix_length, arg);
593 + err |= unresolve_one(p);
594 + if (p != arg)
595 + free((char*)p);
596 }
597 return err;
598 }
@@ -704,7 +708,8 @@ int main(int argc, const char **argv)
708 break;
709 }
710 if (!strcmp(path, "--unresolve")) {
707 - has_errors = do_unresolve(argc - i, argv + i);
711 + has_errors = do_unresolve(argc - i, argv + i,
712 + prefix, prefix_length);
713 if (has_errors)
714 active_cache_changed = 0;
715 goto finish;