summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-01-31 13:34:17 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-31 21:14:32 (GMT)
commit9ebe6cf953123ce904fe6930991694e3a3c79c17 (patch)
tree2ff3ae0d125621241b36e2dcf2aa319961568697 /builtin-update-index.c
parent4a91a1f37e8813bf3b7de00de5b3a7ab1df89451 (diff)
downloadgit-9ebe6cf953123ce904fe6930991694e3a3c79c17.zip
git-9ebe6cf953123ce904fe6930991694e3a3c79c17.tar.gz
git-9ebe6cf953123ce904fe6930991694e3a3c79c17.tar.bz2
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>
Diffstat (limited to 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 182331d..1ac613a 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -501,6 +501,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
for (i = 1 ; i < argc; i++) {
const char *path = argv[i];
+ const char *p;
if (allow_options && *path == '-') {
if (!strcmp(path, "--")) {
@@ -616,9 +617,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
usage(update_index_usage);
die("unknown option %s", path);
}
- update_one(path, prefix, prefix_length);
+ p = prefix_path(prefix, prefix_length, path);
+ update_one(p, NULL, 0);
if (set_executable_bit)
- chmod_path(set_executable_bit, path);
+ chmod_path(set_executable_bit, p);
+ if (p < path || p > path + strlen(path))
+ free((char*)p);
}
if (read_from_stdin) {
struct strbuf buf;