pull: introduce a pull.rebase option to enable --rebase
Currently we either need to set branch.<name>.rebase for existing branches if we'd like "git pull" to mean "git pull --rebase", or have the forethought of setting "branch.autosetuprebase" before we create the branch. Introduce a "pull.rebase" option to globally configure "git pull" to mean "git pull --rebase" for any branch. This option will be considered at a lower priority than branch.<name>.rebase, i.e. we could set pull.rebase=true and branch.<name>.rebase=false and the latter configuration option would win. Reviewed-by: Sverre Rabbelier <srabbelier@gmail.com> Reviewed-by: Fernando Vezzosi <buccia@repnz.net> Reviewed-by: Eric Herman <eric@freesa.org> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Liked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f696543dad
commit
6b37dff17f
@ -94,16 +94,35 @@ test_expect_success '--rebase' '
|
||||
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
|
||||
test new = $(git show HEAD:file2)
|
||||
'
|
||||
test_expect_success 'pull.rebase' '
|
||||
git reset --hard before-rebase &&
|
||||
git config --bool pull.rebase true &&
|
||||
test_when_finished "git config --unset pull.rebase" &&
|
||||
git pull . copy &&
|
||||
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
|
||||
test new = $(git show HEAD:file2)
|
||||
'
|
||||
|
||||
test_expect_success 'branch.to-rebase.rebase' '
|
||||
git reset --hard before-rebase &&
|
||||
git config branch.to-rebase.rebase 1 &&
|
||||
git config --bool branch.to-rebase.rebase true &&
|
||||
test_when_finished "git config --unset branch.to-rebase.rebase" &&
|
||||
git pull . copy &&
|
||||
git config branch.to-rebase.rebase 0 &&
|
||||
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
|
||||
test new = $(git show HEAD:file2)
|
||||
'
|
||||
|
||||
test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
|
||||
git reset --hard before-rebase &&
|
||||
git config --bool pull.rebase true &&
|
||||
test_when_finished "git config --unset pull.rebase" &&
|
||||
git config --bool branch.to-rebase.rebase false &&
|
||||
test_when_finished "git config --unset branch.to-rebase.rebase" &&
|
||||
git pull . copy &&
|
||||
test $(git rev-parse HEAD^) != $(git rev-parse copy) &&
|
||||
test new = $(git show HEAD:file2)
|
||||
'
|
||||
|
||||
test_expect_success '--rebase with rebased upstream' '
|
||||
|
||||
git remote add -f me . &&
|
||||
|
Reference in New Issue
Block a user