#!/bin/sh global test_description := ''rebase can handle submodules'' source ./test-lib.sh source "$TEST_DIRECTORY"/lib-submodule-update.sh source "$TEST_DIRECTORY"/lib-rebase.sh proc 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" proc 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 } global 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 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"rebase can handle submodules">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/lib-submodule-update.sh)}) (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/lib-rebase.sh)}) (FuncDef name: git_rebase body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(status)} {(-su)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[43])] ) (AndOr children: [ (SimpleCommand words: [{(ls)} {(-1pR)} {(Lit_Other "*")}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(expect)} spids:[55])] ) (AndOr children: [ (C {(git)} {(checkout)} {(-b)} {(ours)} {(HEAD)}) (AndOr children: [ (SimpleCommand words: [{(echo)} {(x)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(file1)} spids: [78] ) ] ) (AndOr children: [ (C {(git)} {(add)} {(file1)}) (AndOr children: [ (C {(git)} {(commit)} {(-m)} {(add_x)}) (AndOr children: [ (C {(git)} {(revert)} {(HEAD)}) (AndOr children: [ (SimpleCommand words: [{(git)} {(status)} {(-su)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(actual)} spids: [119] ) ] ) (AndOr children: [ (SimpleCommand words: [{(ls)} {(-1pR)} {(Lit_Other "*")}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(actual)} spids: [131] ) ] ) (AndOr children: [ (C {(test_cmp)} {(expect)} {(actual)}) (C {(git)} {(rebase)} {(DQ ($ VSub_Number "$1"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [34] ) spids: [29 33] ) (C {(test_submodule_switch)} {(DQ (git_rebase))}) (FuncDef name: git_rebase_interactive body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(status)} {(-su)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[178])] ) (AndOr children: [ (SimpleCommand words: [{(ls)} {(-1pR)} {(Lit_Other "*")}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(expect)} spids:[190])] ) (AndOr children: [ (C {(git)} {(checkout)} {(-b)} {(ours)} {(HEAD)}) (AndOr children: [ (SimpleCommand words: [{(echo)} {(x)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(file1)} spids: [213] ) ] ) (AndOr children: [ (C {(git)} {(add)} {(file1)}) (AndOr children: [ (C {(git)} {(commit)} {(-m)} {(add_x)}) (AndOr children: [ (C {(git)} {(revert)} {(HEAD)}) (AndOr children: [ (SimpleCommand words: [{(git)} {(status)} {(-su)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(actual)} spids: [254] ) ] ) (AndOr children: [ (SimpleCommand words: [{(ls)} {(-1pR)} {(Lit_Other "*")}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(actual)} spids: [266] ) ] ) (AndOr children: [ (C {(test_cmp)} {(expect)} {(actual)}) (AndOr children: [ (C {(set_fake_editor)}) (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ (fake-editor.sh))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(.git/info/exclude)} spids: [292] ) ] ) (C {(git)} {(rebase)} {(-i)} {(DQ ($ VSub_Number "$1"))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [169] ) spids: [164 168] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR) op: Equal rhs: {(1)} spids: [311] ) ] spids: [311] ) (C {(test_submodule_switch)} {(DQ (git_rebase_interactive))}) (C {(test_done)}) ] )