git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Fleischer <lfleischer@lfos.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: [PATCH v2 2/4] upload-pack: strip refs before calling ref_is_hidden()
Date: Tue,  3 Nov 2015 08:58:15 +0100	[thread overview]
Message-ID: <1446537497-13921-3-git-send-email-lfleischer@lfos.de> (raw)
In-Reply-To: <1446537497-13921-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

  parent reply	other threads:[~2015-11-03  8:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03  7:58 [PATCH v2 0/4] Improve hideRefs when used with namespaces Lukas Fleischer
2015-11-03  7:58 ` [PATCH v2 1/4] Document the semantics of hideRefs " Lukas Fleischer
2015-11-03 21:09   ` Junio C Hamano
2015-11-03  7:58 ` Lukas Fleischer [this message]
2015-11-03  7:58 ` [PATCH v2 3/4] Add support for matching full refs in hideRefs Lukas Fleischer
2015-11-03 21:07   ` Junio C Hamano
2015-11-04 19:09     ` Junio C Hamano
2015-11-03  7:58 ` [PATCH v2 4/4] t5509: add basic tests for hideRefs Lukas Fleischer
2015-11-04 19:36   ` Eric Sunshine
2015-11-04 19:50     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446537497-13921-3-git-send-email-lfleischer@lfos.de \
    --to=lfleischer@lfos.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).