Re: [PATCH 2/2] clone: suppress unexpected default branch advice

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

 



On 25/03/20 06:13AM, Patrick Steinhardt wrote:
> On Wed, Mar 19, 2025 at 08:46:46PM -0500, Justin Tobler wrote:
> > diff --git a/builtin/clone.c b/builtin/clone.c
> > index 9eb66234bc..3b166b05e3 100644
> > --- a/builtin/clone.c
> > +++ b/builtin/clone.c
> > @@ -1523,7 +1523,7 @@ int cmd_clone(int argc,
> >  	}
> >  
> >  	remote_head = find_ref_by_name(refs, "HEAD");
> > -	remote_head_points_at = guess_remote_head(remote_head, mapped_refs, 0, 0);
> > +	remote_head_points_at = guess_remote_head(remote_head, mapped_refs, 0, 1);
> >  
> >  	if (option_branch) {
> >  		our_head_points_at = find_remote_branch(mapped_refs, option_branch);
> 
> Makes sense. You don't have control over the branch name anyway when
> cloning, so it's nonsensical to print that advise. Another subsequent
> step could be to turn the `advise()` into `advise_if_enabled()`, but
> that change isn't really needed for git-clone(1) because there wouldn't
> ever be a reason to print it.

As you mentioned, in this specific situation printing the advice
doesn't make much sense. It would probably be a good idea to allow this
message to be suppressed from other call sites if requested to do so
though. I'll add another patch that turns it into `advise_if_enabled()`
to support this.

> Do we want to add a test somewhere that demonstrates that we don't print
> the advise anymore?

Ya, I'll go ahead and include this in my next version.

Thanks,
-Justin




[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