git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix git-update-index to work with relative pathnames

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jan 31, 2007, 13:48 UTC
Message-ID
<81b0412b0701310548i2925045cr598765b9e7d67b36@mail.gmail.com>
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>
---
 builtin-update-index.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
From e43acd17ccdd0b045a92fe1439554b310e3579c4 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 31 Jan 2007 14:34:17 +0100
Subject: [PATCH] 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>
---
 builtin-update-index.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 182331d..82364c1 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];
+		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(p);
 	}
 	if (read_from_stdin) {
 		struct strbuf buf;
-- 
1.5.0.rc2.150.gd174e
Message 1 of 1 in “Fix git-update-index to work with relative pathnames”
  1. Fix git-update-index to work with relative pathnamesAlex Riesen, Jan 31, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.