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

Re: [PATCH v2] remote: make refspec follow the same disambiguation rule as local refs

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Aug 1, 2018, 18:13 UTC
Message-ID
<20180801181348.106679-1-jonathantanmy@google.com>
In-Reply-To
<xmqq8t5q821c.fsf@gitster-ct.c.googlers.com>
Show 34 quoted lines
> +test_expect_success 'LHS of refspec follows ref disambiguation rules' '
> +	mkdir lhs-ambiguous &&
> +	(
> +		cd lhs-ambiguous &&
> +		git init server &&
> +		test_commit -C server unwanted &&
> +		test_commit -C server wanted &&
> +
> +		git init client &&
> +
> +		# Check a name coming after "refs" alphabetically ...
> +		git -C server update-ref refs/heads/s wanted &&
> +		git -C server update-ref refs/heads/refs/heads/s unwanted &&
> +		git -C client fetch ../server +refs/heads/s:refs/heads/checkthis &&
> +		git -C server rev-parse wanted >expect &&
> +		git -C client rev-parse checkthis >actual &&
> +		test_cmp expect actual &&
> +
> +		# ... and one before.
> +		git -C server update-ref refs/heads/q wanted &&
> +		git -C server update-ref refs/heads/refs/heads/q unwanted &&
> +		git -C client fetch ../server +refs/heads/q:refs/heads/checkthis &&
> +		git -C server rev-parse wanted >expect &&
> +		git -C client rev-parse checkthis >actual &&
> +		test_cmp expect actual &&
> +
> +		# Tags are preferred over branches like refs/{heads,tags}/*
> +		git -C server update-ref refs/tags/t wanted &&
> +		git -C server update-ref refs/heads/t unwanted &&
> +		git -C client fetch ../server +t:refs/heads/checkthis &&
> +		git -C server rev-parse wanted >expect &&
> +		git -C client rev-parse checkthis >actual
> +	)
> +'

Thanks, this looks good to me. Also thanks for adding the "+" in the fetch commands in the test.

Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 7 in “remote: make refspec follow the same disambiguation rule as local refs”
  1. remote: make refspec follow the same disambiguation rule as local refsJunio C Hamano, Aug 1, 2018
  2. Jonathan TanAug 1, 2018
  3. Junio C HamanoAug 1, 2018
  4. Jonathan NiederAug 1, 2018
  5. Junio C HamanoAug 2, 2018
  6. Jonathan NiederAug 2, 2018
  7. remote: make refspec follow the same disambiguation rule as local refsJunio C Hamano, Aug 2, 2018

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.