Subject: Re: [PATCH v3 1/5] pull: rename pull.rename to pull.mode

From: Richard Hansen <[email-masked]>
Date: Mon, 09 Sep 2013 17:23:54 -0400

On 2013-09-08 21:23, Felipe Contreras wrote:
> The old configurations still work, but get deprecated.

Should some tests for the deprecated configs be added?  We wouldn't want
to accidentally break those.

> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index ec57a15..9489a59 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -760,11 +760,11 @@ branch.<name>.mergeoptions::
>  	option values containing whitespace characters are currently not
>  	supported.
>  
> -branch.<name>.rebase::
> -	When true, rebase the branch <name> on top of the fetched branch,
> -	instead of merging the default branch from the default remote when
> -	"git pull" is run. See "pull.rebase" for doing this in a non
> -	branch-specific manner.
> +branch.<name>.pullmode::
> +	When "git pull" is run, this determines if it would either merge or
> +	rebase the fetched branch. The possible values are 'merge' and
> +	'rebase'. See "pull.mode" for doing this in a non branch-specific
> +	manner.
>  +
>  *NOTE*: this is a possibly dangerous operation; do *not* use
>  it unless you understand the implications (see linkgit:git-rebase[1]
> @@ -1820,11 +1820,11 @@ pretty.<name>::
>  	Note that an alias with the same name as a built-in format
>  	will be silently ignored.
>  
> -pull.rebase::
> -	When true, rebase branches on top of the fetched branch, instead
> -	of merging the default branch from the default remote when "git
> -	pull" is run. See "branch.<name>.rebase" for setting this on a
> -	per-branch basis.
> +pull.mode::
> +	When "git pull" is run, this determines if it would either merge or
> +	rebase the fetched branch. The possible values are 'merge' and
> +	'rebase'. See "branch.<name>.pullmode" for doing this in a non
> +	branch-specific manner.
>  +
>  *NOTE*: this is a possibly dangerous operation; do *not* use
>  it unless you understand the implications (see linkgit:git-rebase[1]

Somewhere something should mention what the default values are
(branch.<name>.pullmode defaults to pull.mode and pull.mode defaults to
merge).

> diff --git a/git-pull.sh b/git-pull.sh
> index f0df41c..de57c1d 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -43,10 +43,24 @@ log_arg= verbosity= progress= recurse_submodules= verify_signatures=
>  merge_args= edit=
>  curr_branch=$(git symbolic-ref -q HEAD)
>  curr_branch_short="${curr_branch#refs/heads/}"
> -rebase=$(git config --bool branch.$curr_branch_short.rebase)
> +mode=$(git config branch.${curr_branch_short}.pullmode)
> +if test -z "$mode"
> +then
> +	mode=$(git config pull.mode)
> +fi
> +test "$mode" == 'rebase' && rebase="true"
>  if test -z "$rebase"
>  then
> -	rebase=$(git config --bool pull.rebase)
> +	rebase=$(git config --bool branch.$curr_branch_short.rebase)
> +	if test -z "$rebase"
> +	then
> +		rebase=$(git config --bool pull.rebase)
> +	fi
> +	if test "$rebase" = 'true'
> +	then
> +		echo "The configurations pull.rebase and branch.<name>.rebase are deprecated."
> +		echo "Please use pull.mode and branch.<name>.pullmode instead."
> +	fi
>  fi
>  dry_run=
>  while :

These deprecation warning messages should be written to stderr, and
should probably be prefixed with "WARNING: ".

-Richard