public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Lukas Fleischer <lfleischer@lfos•de>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] Allow hideRefs to match refs outside the namespace
Date: Wed, 28 Oct 2015 09:21:59 -0700	[thread overview]
Message-ID: <xmqq1tcfm09k.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1446046920-15646-1-git-send-email-lfleischer@lfos.de> (Lukas Fleischer's message of "Wed, 28 Oct 2015 16:42:00 +0100")

Lukas Fleischer <lfleischer@lfos•de> writes:

> Right now, refs with a path outside the current namespace are replaced
> by ".have" before passing them to show_ref() which in turn checks
> whether the ref matches the hideRefs pattern. Move the check before the
> path substitution in show_ref_cb() such that the hideRefs feature can be
> used to hide specific refs outside the current namespace.
>
> Signed-off-by: Lukas Fleischer <lfleischer@lfos•de>
> ---
> The other show_ref() call sites are in show_one_alternate_sha1() and in
> write_head_info(). The call site in show_one_alternate_sha1() is for
> alternates and passes ".have". The other one is
>
>     show_ref("capabilities^{}", null_sha1);
>
> and is not relevant to the hideRefs feature. Note that this kind of
> breaks backwards compatibility since the "magic" hideRefs patterns
> ".have" and "capabilities^{}" no longer work, as explained in the
> discussion.

If somebody is using namespaces and has "refs/frotz/" in the
hiderefs configuration, we hide refs/frotz/ no matter which
namespace is being accessed.  With this change, with the removal the
check from show_ref(), wouldn't such a repository suddenly see a
behaviour change?

>  builtin/receive-pack.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index bcb624b..4a5d0ae 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -195,9 +195,6 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
>  
>  static void show_ref(const char *path, const unsigned char *sha1)
>  {
> -	if (ref_is_hidden(path))
> -		return;
> -
>  	if (sent_capabilities) {
>  		packet_write(1, "%s %s\n", sha1_to_hex(sha1), path);
>  	} else {
> @@ -221,6 +218,9 @@ static void show_ref(const char *path, const unsigned char *sha1)
>  
>  static int show_ref_cb(const char *path, const struct object_id *oid, int flag, void *unused)
>  {
> +	if (ref_is_hidden(path))
> +		return 0;
> +
>  	path = strip_namespace(path);
>  	/*
>  	 * Advertise refs outside our current namespace as ".have"

  reply	other threads:[~2015-10-28 16:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26  8:09 [PATCH/RFC] receive-pack: allow for hiding refs outside the namespace Lukas Fleischer
2015-10-26 19:58 ` Junio C Hamano
     [not found]   ` <20151027053916.3030.8259@typhoon.lan>
     [not found]     ` <20151027055911.4877.94179@typhoon.lan>
2015-10-27 14:32       ` Lukas Fleischer
2015-10-27 18:18         ` Junio C Hamano
2015-10-28  7:00           ` Lukas Fleischer
2015-10-28 13:42             ` Jeff King
2015-10-28 15:48             ` Junio C Hamano
2015-10-30 21:31         ` Junio C Hamano
2015-10-30 21:46           ` Jeff King
2015-10-31  9:03             ` Lukas Fleischer
2015-10-28 15:42 ` [PATCH] Allow hideRefs to match " Lukas Fleischer
2015-10-28 16:21   ` Junio C Hamano [this message]
2015-10-31  8:49     ` Lukas Fleischer
2015-10-31 17:31       ` Junio C Hamano
2015-10-31 23:40         ` Lukas Fleischer
2015-11-01 11:27           ` Lukas Fleischer
2015-11-01 18:18             ` Junio C Hamano

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=xmqq1tcfm09k.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=lfleischer@lfos$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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