Re: [PATCH 09/14] rebase: add t3426 for submodule updates
On Sun, Jun 15, 2014 at 1:02 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
Show 59 quoted lines
> Test that the rebase command updates the work tree as expected for
> changes which don't result in conflicts. To make that work add two
> helper functions that add a commit only touching files and then
> revert it. This allows to rebase the target commit over these two
> and to compare the result.
>
> Set KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR to
> document that "replace directory with submodule" fails for an
> interactive rebase because a directory "sub1" already exists.
>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> ---
> t/t3426-rebase-submodule.sh | 46 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
> create mode 100755 t/t3426-rebase-submodule.sh
>
> diff --git a/t/t3426-rebase-submodule.sh b/t/t3426-rebase-submodule.sh
> new file mode 100755
> index 0000000..019ce52
> --- /dev/null
> +++ b/t/t3426-rebase-submodule.sh
> @@ -0,0 +1,46 @@
> +#!/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 >expected &&
> + ls -1pR * >>expected &&
> + 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 expected actual &&
> + git rebase "$1"
> +}
> +
> +test_submodule_switch "git_rebase"
> +
> +git_rebase_interactive () {
> + git status -su >expected &&
> + ls -1pR * >>expected &&
> + 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 expected actual &&
> + set_fake_editor &&
> + echo "fake-editor.sh" >.git/info/excludeShow 11 quoted lines
> + git rebase -i "$1"
> +}
> +
> +KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
> +# The real reason "replace directory with submodule" fails is because a
> +# directory "sub1" exists, but we reuse the suppression added for merge here
> +test_submodule_switch "git_rebase_interactive"
> +
> +test_done
> --
> 2.0.0.275.gc479268