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

Re: [PATCH v2 2/2] refs: allow @{n} to work with n-sized reflog

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jan 6, 2021, 09:59 UTC
Message-ID
<20210106095947.GP8396@szeder.dev>
In-Reply-To
<18a35506b87356c1ae844d2686b2be6bd04567b2.1609923643.git.liu.denton@gmail.com>
On Wed, Jan 06, 2021 at 01:01:54AM -0800, Denton Liu wrote:
Show 23 quoted lines
> diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
> index 4a9964e9dc..15aac6e77a 100755
> --- a/t/t1508-at-combinations.sh
> +++ b/t/t1508-at-combinations.sh
> @@ -99,4 +99,20 @@ test_expect_success 'create path with @' '
>  check "@:normal" blob content
>  check "@:fun@ny" blob content
>  
> +test_expect_success '@{1} works with only one reflog entry' '
> +	git checkout -B newbranch master &&
> +	git reflog expire --expire=now refs/heads/newbranch &&
> +	git commit --allow-empty -m "first after expiration" &&
> +	git rev-parse newbranch~ >expect &&
> +	git rev-parse newbranch@{1} >actual &&
> +	test_cmp expect actual
> +'
> +
> +test_expect_success '@{0} works with empty reflog' '
> +	git checkout -B newbranch master &&
> +	git reflog expire --expire=now refs/heads/newbranch &&
> +	git rev-parse newbranch >expect &&
> +	git rev-parse newbranch@{0} >actual &&
> +	test_cmp expect actual

You could use 'test_cmp_rev' in these two tests to spare a few lines and to get a bit friendlier error message on failure.

Previous: Denton LiuNext: Denton Liu
Message 11 of 21 in “refs: allow @{n} to work with n-sized reflog”
  1. refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 2, 2021
  2. Martin ÅgrenJan 2, 2021
  3. Denton LiuJan 3, 2021
  4. SZEDER GáborJan 5, 2021
  5. Junio C HamanoJan 6, 2021
  6. Denton LiuJan 6, 2021
  7. Junio C HamanoJan 6, 2021
  8. 0/2 refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 6, 2021
  9. 1/2 refs: factor out set_read_ref_cutoffs()Denton Liu, Jan 6, 2021
  10. 2/2 refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 6, 2021
  11. SZEDER GáborJan 6, 2021
  12. 0/2 refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 7, 2021
  13. 1/2 refs: factor out set_read_ref_cutoffs()Denton Liu, Jan 7, 2021
  14. 2/2 refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 7, 2021
  15. Simon RuderichJan 10, 2021
  16. fixup! refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 12, 2021
  17. Denton LiuJan 12, 2021
  18. Junio C HamanoJan 12, 2021
  19. SZEDER GáborJan 10, 2021
  20. Junio C HamanoJan 10, 2021
  21. 3/2 fixup! refs: allow @{n} to work with n-sized reflogDenton Liu, Jan 7, 2021

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.