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

Re: [PATCH v2 3/4] Add support for matching full refs in hideRefs

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 3, 2015, 21:07 UTC
Message-ID
<xmqqd1vqdc7c.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1446537497-13921-4-git-send-email-lfleischer@lfos.de>
Lukas Fleischer <lfleischer@lfos.de> writes:
Show 22 quoted lines
>  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 {
> @@ -219,9 +216,14 @@ 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)
> +static int show_ref_cb(const char *path_full, const struct object_id *oid,
> +		       int flag, void *unused)
>  {
> -	path = strip_namespace(path);
> +	const char *path = strip_namespace(path_full);
> +
> +	if (ref_is_hidden(path, path_full))
> +		return 1;
> +

These two hunks are doing a bit more than the primary topic of this step, aren't they?

The semantics of "hideRefs" used to be that "refs can be hidden from ls-remote" (i.e. prevents fetching, avoids contaminating "--mirror") and "refs can be hidden from 'push'", but the objects being known tips of histories that are complete, they still participate in common ancestor discovery.

Show 11 quoted lines
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 3da97a1..91ed6a5 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2690,7 +2690,8 @@ the prefix `refs/heads/master` is specified in `transfer.hideRefs` and the
>  current namespace is `foo`, then `refs/namespaces/foo/refs/heads/master` is
>  omitted from the advertisements but `refs/heads/master` and
>  `refs/namespaces/bar/refs/heads/master` are still advertised as so-called
> -"have" lines.
> +"have" lines. In order to match refs before stripping, add a `^` in front of
> +the ref name. If you combine `!` and `^`, `!` must be specified first.

I think the changes in the above two hunks prevent the hidden refs from participating in common ancestor discovery (which is probably a good thing), making the above description stale.

Previous: Lukas FleischerNext: Junio C Hamano
Message 6 of 10 in “Improve hideRefs when used with namespaces”
  1. 0/4 Improve hideRefs when used with namespacesLukas Fleischer, Nov 3, 2015
  2. 1/4 Document the semantics of hideRefs with namespacesLukas Fleischer, Nov 3, 2015
  3. Junio C HamanoNov 3, 2015
  4. 2/4 upload-pack: strip refs before calling ref_is_hidden()Lukas Fleischer, Nov 3, 2015
  5. 3/4 Add support for matching full refs in hideRefsLukas Fleischer, Nov 3, 2015
  6. Junio C HamanoNov 3, 2015
  7. Junio C HamanoNov 4, 2015
  8. 4/4 t5509: add basic tests for hideRefsLukas Fleischer, Nov 3, 2015
  9. Eric SunshineNov 4, 2015
  10. Jeff KingNov 4, 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.