On Fri, Sep 20, 2019 at 11:14:56AM -0400, Derrick Stolee wrote:
> On 9/19/2019 5:47 PM, SZEDER Gábor wrote:
> > These conditions are not covered properly in the test suite. As far
> > as purely test coverage goes, they are all executed several times over
> > in 't6120-describe.sh'. However, they don't directly influence the
> > command's output, because the repository used in that test script
> > contains several branches and tags pointing somewhere into the middle
> > of the commit DAG, and thus result in a better name for the
> > to-be-named commit.
> > diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
> > index 07e6793e84..2a0f2204c4 100755
> > --- a/t/t6120-describe.sh
> > +++ b/t/t6120-describe.sh
> > @@ -421,4 +421,47 @@ test_expect_success 'describe complains about missing
> > object' '
> > test_must_fail git describe $ZERO_OID
> > '
> >
> > +# -----------master
> > +# / /
> > +# A----------M2
> > +# \ /
> > +# \---M1-C
> > +# \ /
> > +# B
> > +test_expect_success 'test' '
> > + git init repo &&
> > + (
> > + cd repo &&
> > +
> > + echo A >file &&
> > + git add file &&
> > + git commit -m A &&
> > + A=$(git rev-parse HEAD) &&
>
> Is it not enough to do something like test_commit here?
No, because 'test_commit' adds branches and tags pointing to commits
somewhere in the middle of the history, and those will serve as better
starting point for the resulting name.
> > +
> > + git checkout --detach &&
> > + echo B >file &&
> > + git commit -m B file &&
> > + B=$(git rev-parse HEAD) &&
> > +
> > + git checkout $A &&
> > + git merge --no-ff $B && # M1
> > +
> > + echo C >file &&
> > + git commit -m C file &&
> > +
> > + git checkout $A &&
> > + git merge --no-ff HEAD@{1} && # M2
> > +
> > + git checkout master &&
> > + git merge --no-ff HEAD@{1} &&
> > +
> > + git log --graph --oneline &&
> > +
> > + echo "$B master^2^2~1^2" >expect &&
> > + git name-rev $B >actual &&
>
> This matches your description.
>
> Thanks,
> -Stolee
>