Re: [PATCH v6 1/5] branch: move --set-upstream-to behavior to dwim_and_setup_tracking()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Glen Choo <chooglen@xxxxxxxxxx> writes:
> >> @@ -401,7 +410,34 @@ void create_branch(struct repository *r,
> >>  
> >>  	if ((commit = lookup_commit_reference(r, &oid)) == NULL)
> >>  		die(_("Not a valid branch point: '%s'."), start_name);
> >> -	oidcpy(&oid, &commit->object.oid);
> >> +	if (out_real_ref)
> >> +		*out_real_ref = real_ref ? xstrdup(real_ref) : NULL;
> >
> > I think you can just write "*out_real_ref = real_ref; real_ref = NULL;"
> > here, and then not need to xstrdup.
> 
> Hm, you are right. The xstrdup was added because the original function
> calls FREE_AND_NULL(real_ref) and then checks if real_ref is NULL. But
> after the refactor, real_ref is not referenced after the
> FREE_AND_NULL(real_ref), so that call can be removed.
> 
> I intend to remove the xstrdup, though it will introduce a bit of noise
> because that block will no longer be moved wholesale.

Ah, thanks for watching out for the diff. I think in this case, we'll be
fine, since the xstrdup line is a new line ("xstrdup" only appears once
in the diff, here).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux