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

[PATCH] Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()

From
MMustafaOrkunAcar <mustafaorkunacar@gmail.com>
Date
Mar 20, 2014, 10:04 UTC
Message-ID
<1395309889-340-1-git-send-email-mustafaorkunacar@gmail.com>
Hi, I have completed one of the microprojects -14th one: "Change fetch-pack.c:filter_refs() to use starts_with() instead of memcmp()." The only line in the function filter_refs() containing memcmp() is changed with starts_with(). I plan to apply for GSoC 2014. Any feedback is appreciated. Thanks. 
Signed-off-by: MustafaOrkunAcar <mustafaorkunacar@gmail.com>
---
 fetch-pack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index f061f1f..17823ab 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -506,7 +506,7 @@ static void filter_refs(struct fetch_pack_args *args,
 		int keep = 0;
 		next = ref->next;
 
-		if (!memcmp(ref->name, "refs/", 5) &&
+		if (starts_with(ref->name, "refs/") &&
 		    check_refname_format(ref->name, 0))
 			; /* trash */
 		else {
-- 
1.9.1.286.g5172cb3
Next: Eric Sunshine
Message 1 of 2 in “Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()”
  1. Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()MustafaOrkunAcar, Mar 20, 2014
  2. Eric SunshineMar 21, 2014

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.