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

Re: t7400 broken on pu (Mac OS X)

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 10, 2013, 06:28 UTC
Message-ID
<20130110062838.GA11634@duynguyen-vnpc.dek-tpc.internal>
In-Reply-To
<50EDBA37.30205@web.de>
On Wed, Jan 09, 2013 at 07:43:03PM +0100, Torsten Bögershausen wrote:
Show 10 quoted lines
> The current pu fails on Mac OS, case insensitive FS.
> 
> 
> Bisecting points out
> commit 3f28e4fafc046284657945798d71c57608bee479
> [snip]
> Date:   Sun Jan 6 13:21:07 2013 +0700
> 
>     Convert add_files_to_cache to take struct pathspec
> 

I can reproduce it by setting core.ignorecase to true. There is a bug that I overlooked. Can you verify if this throw-away patch fixes it for you? A proper fix will be in the reroll later.

-- 8< --
diff --git a/builtin/add.c b/builtin/add.c
index 641037f..61cb8bd 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -155,12 +155,13 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, int
 	return seen;
 }
 
-static void treat_gitlinks(const char **pathspec)
+static int treat_gitlinks(const char **pathspec)
 {
 	int i;
+	int modified = 0;
 
 	if (!pathspec || !*pathspec)
-		return;
+		return modified;
 
 	for (i = 0; i < active_nr; i++) {
 		struct cache_entry *ce = active_cache[i];
@@ -171,15 +172,17 @@ static void treat_gitlinks(const char **pathspec)
 				if (len2 <= len || pathspec[j][len] != '/' ||
 				    memcmp(ce->name, pathspec[j], len))
 					continue;
-				if (len2 == len + 1)
+				if (len2 == len + 1) {
 					/* strip trailing slash */
 					pathspec[j] = xstrndup(ce->name, len);
-				else
+					modified = 1;
+				} else
 					die (_("Path '%s' is in submodule '%.*s'"),
 						pathspec[j], len, ce->name);
 			}
 		}
 	}
+	return modified;
 }
 
 static void refresh(int verbose, const struct pathspec *pathspec)
@@ -418,7 +421,16 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 
 	if (read_cache() < 0)
 		die(_("index file corrupt"));
-	treat_gitlinks(pathspec.raw);
+	if (treat_gitlinks(pathspec.raw))
+		/*
+		 * HACK: treat_gitlinks strips the trailing slashes
+		 * out of submodule entries but it only affects
+		 * raw[]. Everything in pathspec.items is not touched.
+		 * Re-init it to propagate the change. Long term, this
+		 * function should be moved to pathspec.c and update
+		 * everything in a consistent way.
+		 */
+		init_pathspec(&pathspec, pathspec.raw);
 
 	if (add_new_files) {
 		int baselen;
-- 8< --
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “t7400 broken on pu (Mac OS X)”
  1. Torsten BögershausenJan 9, 2013
  2. Junio C HamanoJan 9, 2013
  3. Duy NguyenJan 10, 2013
  4. Junio C HamanoJan 10, 2013
  5. Torsten BögershausenJan 10, 2013
  6. Duy NguyenJan 11, 2013

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.