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

[PATCH 2/4] upload-pack: strip refs before calling ref_is_hidden()

From
Lukas Fleischer <lfleischer@lfos.de>
Date
Nov 1, 2015, 19:34 UTC
Message-ID
<1446406463-22527-3-git-send-email-lfleischer@lfos.de>
In-Reply-To
<1446406463-22527-1-git-send-email-lfleischer@lfos.de>

Make hideRefs handling in upload-pack consistent with the behavior described in the documentation by stripping refs before comparing them with prefixes in hideRefs.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
---
 upload-pack.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/upload-pack.c b/upload-pack.c
index d0bc3ca..4ca960e 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -692,7 +692,7 @@ static int mark_our_ref(const char *refname, const struct object_id *oid)
 {
 	struct object *o = lookup_unknown_object(oid->hash);
 
-	if (ref_is_hidden(refname)) {
+	if (refname && ref_is_hidden(refname)) {
 		o->flags |= HIDDEN_REF;
 		return 1;
 	}
@@ -703,7 +703,7 @@ static int mark_our_ref(const char *refname, const struct object_id *oid)
 static int check_ref(const char *refname, const struct object_id *oid,
 		     int flag, void *cb_data)
 {
-	mark_our_ref(refname, oid);
+	mark_our_ref(strip_namespace(refname), oid);
 	return 0;
 }
 
@@ -726,7 +726,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
 	const char *refname_nons = strip_namespace(refname);
 	struct object_id peeled;
 
-	if (mark_our_ref(refname, oid))
+	if (mark_our_ref(refname_nons, oid))
 		return 0;
 
 	if (capabilities) {
-- 
2.6.2
Previous: Lukas FleischerNext: Lukas Fleischer
Message 3 of 10 in “Improve hideRefs when used with namespaces”
  1. 0/4 Improve hideRefs when used with namespacesLukas Fleischer, Nov 1, 2015
  2. 1/4 Document the semantics of hideRefs with namespacesLukas Fleischer, Nov 1, 2015
  3. 2/4 upload-pack: strip refs before calling ref_is_hidden()Lukas Fleischer, Nov 1, 2015
  4. 3/4 Add support for matching full refs in hideRefsLukas Fleischer, Nov 1, 2015
  5. Eric SunshineNov 1, 2015
  6. Lukas FleischerNov 2, 2015
  7. 4/4 t5509: add basic tests for hideRefsLukas Fleischer, Nov 1, 2015
  8. Eric SunshineNov 1, 2015
  9. Lukas FleischerNov 2, 2015
  10. Eric SunshineNov 2, 2015

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.