1. Stefan Saasen
  2. git

Commits

Alex Riesen  committed 9ebe6cf

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>

  • Participants
  • Parent commits 4a91a1f
  • Branches master

Comments (0)

Files changed (1)

File builtin-update-index.c

View file
 
 	for (i = 1 ; i < argc; i++) {
 		const char *path = argv[i];
+		const char *p;
 
 		if (allow_options && *path == '-') {
 			if (!strcmp(path, "--")) {
 				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;