mirror of
https://github.com/git/git.git
synced 2024-12-05 07:53:59 +08:00
5423d2e700
When a submodule is being merged or cherry-picked into a working tree that already contains a corresponding empty directory, do not record a conflict. One situation where this bug appears is: - Commit 1 adds a submodule - Commit 2 removes that submodule and re-adds it into a subdirectory (sub1 to sub1/sub1). - Commit 3 adds an unrelated file. Now the user checks out commit 1 (first deinitializing the submodule), and attempts to cherry-pick commit 3. Previously, this would fail, because the incoming submodule sub1/sub1 would falsely conflict with the empty sub1 directory. This patch ignores the empty sub1 directory, fixing the bug. We only ignore the empty directory if the object being emplaced is a submodule, which expects an empty directory. Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
44 lines
877 B
Bash
Executable File
44 lines
877 B
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 &&
|
|
git rebase "$1"
|
|
}
|
|
|
|
test_submodule_switch "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 &&
|
|
echo "fake-editor.sh" >.git/info/exclude &&
|
|
git rebase -i "$1"
|
|
}
|
|
|
|
test_submodule_switch "git_rebase_interactive"
|
|
|
|
test_done
|