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

[PATCH 4/4] connect.c: drop path_match function

From
Jeff King <peff@peff.net>
Date
Dec 13, 2011, 00:49 UTC
Message-ID
<20111213004959.GD3699@sigill.intra.peff.net>
In-Reply-To
<20111213003925.GA28403@sigill.intra.peff.net>

This function was used for comparing local and remote ref names during fetch (which makes it a candidate for "most confusingly named function of the year").

It no longer has any callers, so let's get rid of it.
Signed-off-by: Jeff King <peff@peff.net>
---
I just did the exact-string match inline in the previous patch. I could
also have modified path_match to do it. But really, I can't think of a
worse name for a global function in a system which is all about
managing content in paths. Unless, you know, it actually matched paths.
Which it doesn't.
 cache.h   |    1 -
 connect.c |   21 ---------------------
 2 files changed, 0 insertions(+), 22 deletions(-)
diff --git a/cache.h b/cache.h
index 408e880..2ad063f 100644
--- a/cache.h
+++ b/cache.h
@@ -1029,7 +1029,6 @@ struct ref {
 extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
 extern int finish_connect(struct child_process *conn);
 extern int git_connection_is_socket(struct child_process *conn);
-extern int path_match(const char *path, int nr, char **match);
 struct extra_have_objects {
 	int nr, alloc;
 	unsigned char (*array)[20];
diff --git a/connect.c b/connect.c
index 48df90b..2a0a040 100644
--- a/connect.c
+++ b/connect.c
@@ -105,27 +105,6 @@ int server_supports(const char *feature)
 		strstr(server_capabilities, feature) != NULL;
 }
 
-int path_match(const char *path, int nr, char **match)
-{
-	int i;
-	int pathlen = strlen(path);
-
-	for (i = 0; i < nr; i++) {
-		char *s = match[i];
-		int len = strlen(s);
-
-		if (!len || len > pathlen)
-			continue;
-		if (memcmp(path + pathlen - len, s, len))
-			continue;
-		if (pathlen > len && path[pathlen - len - 1] != '/')
-			continue;
-		*s = 0;
-		return (i + 1);
-	}
-	return 0;
-}
-
 enum protocol {
 	PROTO_LOCAL = 1,
 	PROTO_SSH,
-- 
1.7.8.13.g74677
Previous: Junio C HamanoNext: Michael Haggerty
Message 7 of 8 in “exact ref-matching for fetch-pack”
  1. 0/4 exact ref-matching for fetch-packJeff King, Dec 13, 2011
  2. 1/4 drop "match" parameter from get_remote_headsJeff King, Dec 13, 2011
  3. 2/4 t5500: give fully-qualified refs to fetch-packJeff King, Dec 13, 2011
  4. 3/4 fetch-pack: match refs exactlyJeff King, Dec 13, 2011
  5. Jeff KingDec 13, 2011
  6. Junio C HamanoDec 15, 2011
  7. 4/4 connect.c: drop path_match functionJeff King, Dec 13, 2011
  8. Michael HaggertyDec 13, 2011

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.