Re: [PATCH 5/5] pull: abort by default when fast-forwarding is not possible

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

 



On Thu, Jul 15 2021, Elijah Newren via GitGitGadget wrote:

> -static void show_advice_pull_non_ff(void)
> +static void NORETURN die_pull_non_ff(void)
>  {
> -	advise(_("Pulling without specifying how to reconcile divergent branches is\n"
> -		 "discouraged. You can squelch this message by running one of the following\n"
> -		 "commands sometime before your next pull:\n"
> -		 "\n"
> -		 "  git config pull.rebase false  # merge (the default strategy)\n"
> -		 "  git config pull.rebase true   # rebase\n"
> -		 "  git config pull.ff only       # fast-forward only\n"
> -		 "\n"
> -		 "You can replace \"git config\" with \"git config --global\" to set a default\n"
> -		 "preference for all repositories. You can also pass --rebase, --no-rebase,\n"
> -		 "or --ff-only on the command line to override the configured default per\n"
> -		 "invocation.\n"));
> +	die(_("You have divergent branches and need to specify how to reconcile them.\n"
> +	      "You can do so by running one of the following commands sometime before\n"
> +	      "your next pull:\n"
> +	      "\n"
> +	      "  git config pull.rebase false  # merge (the default strategy)\n"
> +	      "  git config pull.rebase true   # rebase\n"
> +	      "  git config pull.ff only       # fast-forward only\n"
> +	      "\n"
> +	      "You can replace \"git config\" with \"git config --global\" to set a default\n"
> +	      "preference for all repositories. You can also pass --rebase, --no-rebase,\n"
> +	      "or --ff-only on the command line to override the configured default per\n"
> +	      "invocation.\n"));
>  }

Dying and advise() shouldn't be mutually exclusive, we should reword the
advise() message to idate for this being a die(), and then:

>  int cmd_pull(int argc, const char **argv, const char *prefix)
> @@ -1074,9 +1074,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
>  		if (opt_ff) {
>  			if (!strcmp(opt_ff, "--ff-only"))
>  				die_ff_impossible();
> -		} else {
> -			if (rebase_unspecified && opt_verbosity >= 0)
> -				show_advice_pull_non_ff();
> +		} else if (rebase_unspecified) {
> +			die_pull_non_ff();
>  		}

Here we should:

    show_advice_pull_non_ff();
    die(_("some much briefer summary"))

I.e. we should not being showing giantic advice-y die() messages, the
die messages should always be brief, but we might also show advice just
before dying.



[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