Merge branch 'dl/rebase-with-autobase'

"git rebase" did not work well when format.useAutoBase
configuration variable is set, which has been corrected.

* dl/rebase-with-autobase:
  rebase: fix format.useAutoBase breakage
  format-patch: teach --no-base
  t4014: use test_config()
  format-patch: fix indentation
  t3400: demonstrate failure with format.useAutoBase
This commit is contained in:
Junio C Hamano
2019-12-16 13:08:32 -08:00
5 changed files with 26 additions and 11 deletions

View File

@ -159,6 +159,12 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
test_must_fail git rebase
'
test_expect_success 'rebase works with format.useAutoBase' '
test_config format.useAutoBase true &&
git checkout topic &&
git rebase master
'
test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg' '
git checkout -b default-base master &&
git checkout -b default topic &&

View File

@ -1939,10 +1939,9 @@ test_expect_success 'format-patch errors out when history involves criss-cross'
test_must_fail git format-patch --base=auto -1
'
test_expect_success 'format-patch format.useAutoBaseoption' '
test_when_finished "git config --unset format.useAutoBase" &&
test_expect_success 'format-patch format.useAutoBase option' '
git checkout local &&
git config format.useAutoBase true &&
test_config format.useAutoBase true &&
git format-patch --stdout -1 >patch &&
grep "^base-commit:" patch >actual &&
git rev-parse upstream >commit-id-base &&
@ -1951,8 +1950,7 @@ test_expect_success 'format-patch format.useAutoBaseoption' '
'
test_expect_success 'format-patch --base overrides format.useAutoBase' '
test_when_finished "git config --unset format.useAutoBase" &&
git config format.useAutoBase true &&
test_config format.useAutoBase true &&
git format-patch --stdout --base=HEAD~1 -1 >patch &&
grep "^base-commit:" patch >actual &&
git rev-parse HEAD~1 >commit-id-base &&
@ -1960,6 +1958,12 @@ test_expect_success 'format-patch --base overrides format.useAutoBase' '
test_cmp expect actual
'
test_expect_success 'format-patch --no-base overrides format.useAutoBase' '
test_config format.useAutoBase true &&
git format-patch --stdout --no-base -1 >patch &&
! grep "^base-commit:" patch
'
test_expect_success 'format-patch --base with --attach' '
git format-patch --attach=mimemime --stdout --base=HEAD~ -1 >patch &&
sed -n -e "/^base-commit:/s/.*/1/p" -e "/^---*mimemime--$/s/.*/2/p" \