@matheusbsbs / matheus-bagliano / commits / 9ebe6cf953
Fork 0

Fix git-update-index to work with relative pathnames.

In particular, it fixes the following (typical for cygwin) problem: $ git-update-index --chmod=-x ../wrapper/Jamfile fatal: git-update-index: cannot chmod -x '../wrapper/Jamfile' Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alex Riesen committed Jan 31, 2007 at 14:34 UTC 9ebe6cf953123ce904fe6930991694e3a3c79c17
1 file changed +6 -2
builtin-update-index.c
+6 -2
@@ -501,6 +501,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
501
502 for (i = 1 ; i < argc; i++) {
503 const char *path = argv[i];
504 + const char *p;
505
506 if (allow_options && *path == '-') {
507 if (!strcmp(path, "--")) {
@@ -616,9 +617,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
617 usage(update_index_usage);
618 die("unknown option %s", path);
619 }
619 - update_one(path, prefix, prefix_length);
620 + p = prefix_path(prefix, prefix_length, path);
621 + update_one(p, NULL, 0);
622 if (set_executable_bit)
621 - chmod_path(set_executable_bit, path);
623 + chmod_path(set_executable_bit, p);
624 + if (p < path || p > path + strlen(path))
625 + free((char*)p);
626 }
627 if (read_from_stdin) {
628 struct strbuf buf;