From: SZEDER Gábor Date: Wed, 06 Jan 2021 09:59:47 GMT Subject: Re: [PATCH v2 2/2] refs: allow @{n} to work with n-sized reflog 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: > 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.