Re: t7400 broken on pu (Mac OS X)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 09, 2013 at 07:43:03PM +0100, Torsten Bögershausen wrote:
> 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< --
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]