#!/bin/sh global test_description := ''pull can handle submodules'' source ./test-lib.sh source "$TEST_DIRECTORY"/lib-submodule-update.sh proc reset_branch_to_HEAD { git branch -D $1 && git checkout -b $1 HEAD && git branch --set-upstream-to="origin/$1" $1 } proc git_pull { reset_branch_to_HEAD $1 && git pull } # pulls without conflicts test_submodule_switch "git_pull" proc git_pull_ff { reset_branch_to_HEAD $1 && git pull --ff } test_submodule_switch "git_pull_ff" proc git_pull_ff_only { reset_branch_to_HEAD $1 && git pull --ff-only } test_submodule_switch "git_pull_ff_only" proc git_pull_noff { reset_branch_to_HEAD $1 && git pull --no-ff } global KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR := '1' global KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES := '1' test_submodule_switch "git_pull_noff" test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"pull can handle submodules">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/lib-submodule-update.sh)}) (FuncDef name: reset_branch_to_HEAD body: (BraceGroup children: [ (AndOr children: [ (C {(git)} {(branch)} {(-D)} {(DQ ($ VSub_Number "$1"))}) (AndOr children: [ (C {(git)} {(checkout)} {(-b)} {(DQ ($ VSub_Number "$1"))} {(HEAD)}) (C {(git)} {(branch)} {(--set-upstream-to) (Lit_Other "=") (DQ (origin/) ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$1"))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [27] ) spids: [22 26] ) (FuncDef name: git_pull body: (BraceGroup children: [ (AndOr children: [(C {(reset_branch_to_HEAD)} {(DQ ($ VSub_Number "$1"))}) (C {(git)} {(pull)})] op_id: Op_DAmp ) ] spids: [81] ) spids: [76 80] ) (C {(test_submodule_switch)} {(DQ (git_pull))}) (FuncDef name: git_pull_ff body: (BraceGroup children: [ (AndOr children: [ (C {(reset_branch_to_HEAD)} {(DQ ($ VSub_Number "$1"))}) (C {(git)} {(pull)} {(--ff)}) ] op_id: Op_DAmp ) ] spids: [115] ) spids: [110 114] ) (C {(test_submodule_switch)} {(DQ (git_pull_ff))}) (FuncDef name: git_pull_ff_only body: (BraceGroup children: [ (AndOr children: [ (C {(reset_branch_to_HEAD)} {(DQ ($ VSub_Number "$1"))}) (C {(git)} {(pull)} {(--ff-only)}) ] op_id: Op_DAmp ) ] spids: [148] ) spids: [143 147] ) (C {(test_submodule_switch)} {(DQ (git_pull_ff_only))}) (FuncDef name: git_pull_noff body: (BraceGroup children: [ (AndOr children: [ (C {(reset_branch_to_HEAD)} {(DQ ($ VSub_Number "$1"))}) (C {(git)} {(pull)} {(--no-ff)}) ] op_id: Op_DAmp ) ] spids: [181] ) spids: [176 180] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR) op: Equal rhs: {(1)} spids: [202] ) ] spids: [202] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES) op: Equal rhs: {(1)} spids: [205] ) ] spids: [205] ) (C {(test_submodule_switch)} {(DQ (git_pull_noff))}) (C {(test_done)}) ] )