mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
![Ævar Arnfjörð Bjarmason](/assets/img/avatar_default.png)
Change those tests that assumed that a .git/info directory would be created for them when writing .git/info/exclude to explicitly create the directory by setting "TEST_CREATE_REPO_NO_TEMPLATE=1" before sourcing test-lib.sh, and using the "--template=" argument to "git clone" and "git init". In the case of ".git/modules/sub1/info" we deviate from the established pattern in this and preceding commits of passing a "--template=" and doing a "mkdir .git/info". In that case "git checkout" will run the "submodule--helper clone", and both e.g. "git submodule update --init" and "git checkout" do not have a way to pass down options to the eventual "git init" or "git clone". Let's instead assume that the submodule was populated with our default templates, remove them, and then run the "mkdir". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
64 lines
1.5 KiB
Bash
Executable file
64 lines
1.5 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='rebase can handle submodules'
|
|
|
|
. ./test-lib.sh
|
|
. "$TEST_DIRECTORY"/lib-submodule-update.sh
|
|
. "$TEST_DIRECTORY"/lib-rebase.sh
|
|
|
|
git_rebase () {
|
|
git status -su >expect &&
|
|
ls -1pR * >>expect &&
|
|
git checkout -b ours HEAD &&
|
|
echo x >>file1 &&
|
|
git add file1 &&
|
|
git commit -m add_x &&
|
|
git revert HEAD &&
|
|
git status -su >actual &&
|
|
ls -1pR * >>actual &&
|
|
test_cmp expect actual &&
|
|
may_only_be_test_must_fail "$2" &&
|
|
$2 git rebase "$1"
|
|
}
|
|
|
|
test_submodule_switch_func "git_rebase"
|
|
|
|
git_rebase_interactive () {
|
|
git status -su >expect &&
|
|
ls -1pR * >>expect &&
|
|
git checkout -b ours HEAD &&
|
|
echo x >>file1 &&
|
|
git add file1 &&
|
|
git commit -m add_x &&
|
|
git revert HEAD &&
|
|
git status -su >actual &&
|
|
ls -1pR * >>actual &&
|
|
test_cmp expect actual &&
|
|
set_fake_editor &&
|
|
mkdir .git/info &&
|
|
echo "fake-editor.sh" >.git/info/exclude &&
|
|
may_only_be_test_must_fail "$2" &&
|
|
$2 git rebase -i "$1"
|
|
}
|
|
|
|
test_submodule_switch_func "git_rebase_interactive"
|
|
|
|
test_expect_success 'rebase interactive ignores modified submodules' '
|
|
test_when_finished "rm -rf super sub" &&
|
|
git init sub &&
|
|
git -C sub commit --allow-empty -m "Initial commit" &&
|
|
git init super &&
|
|
git -C super submodule add ../sub &&
|
|
git -C super config submodule.sub.ignore dirty &&
|
|
>super/foo &&
|
|
git -C super add foo &&
|
|
git -C super commit -m "Initial commit" &&
|
|
test_commit -C super a &&
|
|
test_commit -C super b &&
|
|
test_commit -C super/sub c &&
|
|
set_fake_editor &&
|
|
git -C super rebase -i HEAD^^
|
|
'
|
|
|
|
test_done
|