Re: [RFC v2] revision: Add --sticky-default option

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

 



On Wed, Oct 17, 2018 at 03:49:47PM +0200, Andreas Gruenbacher wrote:

> @@ -2431,7 +2446,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
>  		opt->tweak(revs, opt);
>  	if (revs->show_merge)
>  		prepare_show_merge(revs);
> -	if (revs->def && !revs->pending.nr && !revs->rev_input_given && !got_rev_arg) {
> +	if (revs->sticky_default)
> +		cancel_default = has_interesting_revisions();
> +	else
> +		cancel_default = got_rev_arg;
> +	if (revs->def && !revs->rev_input_given && !cancel_default) {

How do you want to handle "maybe has a ref" options like --stdin,
--tags, etc? Those set revs->rev_input_given.

With the code you have here, rev_input_given overrides any
sticky_default decision, and you cannot do this:

  git log --not --remotes=origin

and get the default, because even though you have only UNINTERESTING
commits, rev_input_given is true.

If you move rev_input_given to the cancel_default line above the final
conditional and turn that conditional into:

  if (revs->def && !cancel_default)

then it works.

-Peff



[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