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

[PATCH] Fix config key miscount in url.*.insteadOf

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Apr 12, 2008, 19:32 UTC
Message-ID
<alpine.LNX.1.00.0804121530000.19665@iabervon.org>
Also tighten test to require it to be correct.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
After all of the changing the name of the config option, I left the wrong 
count for the key length, causing it to eat the first character of the 
URL.
 remote.c              |    2 +-
 t/t5516-fetch-push.sh |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/remote.c b/remote.c
index 08af7f9..369dc33 100644
--- a/remote.c
+++ b/remote.c
@@ -315,7 +315,7 @@ static int handle_config(const char *key, const char *value)
 	}
 	if (!prefixcmp(key, "url.")) {
 		struct rewrite *rewrite;
-		name = key + 5;
+		name = key + 4;
 		subkey = strrchr(name, '.');
 		if (!subkey)
 			return 0;
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 793ffc6..6d7e738 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -103,9 +103,9 @@ test_expect_success 'fetch with wildcard' '
 test_expect_success 'fetch with insteadOf' '
 	mk_empty &&
 	(
-		TRASH=$(pwd) &&
+		TRASH=$(pwd)/ &&
 		cd testrepo &&
-		git config url./$TRASH/.insteadOf trash/
+		git config url.$TRASH.insteadOf trash/
 		git config remote.up.url trash/. &&
 		git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
 		git fetch up &&
@@ -145,8 +145,8 @@ test_expect_success 'push with wildcard' '
 
 test_expect_success 'push with insteadOf' '
 	mk_empty &&
-	TRASH=$(pwd) &&
-	git config url./$TRASH/.insteadOf trash/ &&
+	TRASH=$(pwd)/ &&
+	git config url.$TRASH.insteadOf trash/ &&
 	git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
 	(
 		cd testrepo &&
-- 
1.5.4.3.610.gea6cd
Message 1 of 1 in “Fix config key miscount in url.*.insteadOf”
  1. Fix config key miscount in url.*.insteadOfDaniel Barkalow, Apr 12, 2008

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.