"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: fix cloning of repositories with dangling head reference
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 08 Nov 2022 17:41:48 +0100

Download raw body.

Thread
On 2022/11/08 17:25:39 +0100, Stefan Sperling <stsp@stsp.name> wrote:
> On Tue, Nov 08, 2022 at 05:01:35PM +0100, Omar Polo wrote:
> > > @@ -1881,6 +1882,20 @@ cmd_clone(int argc, char *argv[])
> > >  				goto done;
> > >  			break;
> > >  		}
> > > +
> > > +		if (!fpa.configs_created && target_ref) {
> > 
> > Reached this point target_ref is either NULL or a free'd pointer.
> > It's fine; the integral number doesn't change after passing it to
> > got_ref_close, but I just felt to pointing it out.
> 
> Oh, indeed.
> 
> What we want is to ensure that a known branch exist that will end up
> being written into the config file. It might be better to abuse 'pe'
> as a flag, see below. Less risk of future changes starting to pass the
> variable around after it's been freed.
> 
> > > +	got ref -l -r $testroot/repo-clone > $testroot/stdout
> > > +
> > > +	echo "HEAD: refs/heads/master" > $testroot/stdout.expected
> > > +	echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
> > > +	echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
> > 
> > forgot to cmp stdout and stdout.expected
> 
> Good catch, also fixed below.

ok op@