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

Re: update-cache ./test.c

From
LBLennert Buytenhek <buytenh@wantstofly.org>
Date
May 1, 2005, 08:59 UTC
Message-ID
<20050501085922.GC30692@xi.wantstofly.org>
In-Reply-To
<20050501085427.GB30692@xi.wantstofly.org>
On Sun, May 01, 2005 at 10:54:27AM +0200, Lennert Buytenhek wrote:
> But that wasn't quite the point :)  It makes sense that update-cache
> doesn't like ambiguous path names, but it's easier for update-cache to
> detect and strip "^./" than for me to remember to type sed "s#^./##"
> every time.
Something like this:

--- git/update-cache.c.orig 2005-05-01 10:56:17.859313581 +0200 +++ git/update-cache.c 2005-05-01 10:57:31.634897508 +0200

@@ -328,6 +328,7 @@
 
 	for (i = 1 ; i < argc; i++) {
 		char *path = argv[i];
+		char *_path;
 
 		if (allow_options && *path == '-') {
 			if (!strcmp(path, "--")) {
@@ -358,12 +359,15 @@
 			}
 			die("unknown option %s", path);
 		}
-		if (!verify_path(path)) {
+		_path = path;
+		if (!strncmp(_path, "./", 2))
+			_path += 2;
+		if (!verify_path(_path)) {
 			fprintf(stderr, "Ignoring path %s\n", argv[i]);
 			continue;
 		}
-		if (add_file_to_cache(path))
-			die("Unable to add %s to database", path);
+		if (add_file_to_cache(_path))
+			die("Unable to add %s to database", _path);
 	}
 	if (write_cache(newfd, active_cache, active_nr) || rename(lockfile, indexfile))
 		die("Unable to write new cachefile");
Previous: Lennert BuytenhekNext: Thomas Glanzmann
Message 4 of 7 in “update-cache ./test.c”
  1. Lennert BuytenhekMay 1, 2005
  2. Thomas GlanzmannMay 1, 2005
  3. Lennert BuytenhekMay 1, 2005
  4. Lennert BuytenhekMay 1, 2005
  5. Thomas GlanzmannMay 1, 2005
  6. Junio C HamanoMay 1, 2005
  7. David GreavesMay 1, 2005

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.