(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'git rebase --autostash tests' span_id:15))} spids: [13] ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:28) (Token id:Id.Lit_Chars val:'\techo hello-world >file0 &&\n' span_id:29) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:30) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:31) (Token id:Id.Lit_Chars val:'\tgit commit -m "initial commit" &&\n' span_id:32) (Token id:Id.Lit_Chars val:'\tgit checkout -b feature-branch &&\n' span_id:33) (Token id:Id.Lit_Chars val:'\techo another-hello >file1 &&\n' span_id:34) (Token id:Id.Lit_Chars val:'\techo goodbye >file2 &&\n' span_id:35) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:36) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:37) (Token id:Id.Lit_Chars val:'\tgit commit -m "second commit" &&\n' span_id:38) (Token id:Id.Lit_Chars val:'\techo final-goodbye >file3 &&\n' span_id:39) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:40) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:41) (Token id:Id.Lit_Chars val:'\tgit commit -m "third commit" &&\n' span_id:42) (Token id: Id.Lit_Chars val: '\tgit checkout -b unrelated-onto-branch master &&\n' span_id: 43 ) (Token id:Id.Lit_Chars val:'\techo unrelated >file4 &&\n' span_id:44) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:45) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:46) (Token id:Id.Lit_Chars val:'\tgit commit -m "unrelated commit" &&\n' span_id:47) (Token id:Id.Lit_Chars val:'\tgit checkout -b related-onto-branch master &&\n' span_id:48) (Token id:Id.Lit_Chars val:'\techo conflicting-change >file2 &&\n' span_id:49) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:50) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:51) (Token id:Id.Lit_Chars val:'\tgit commit -m "related commit"\n' span_id:52) ) } ) (command.ShFunction name: testrebase body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:type) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [63] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dotest) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [67] ) ] ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': dirty worktree, --no-autostash'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:81) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 82 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:83) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 84 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 85 ) (Token id:Id.Lit_Chars val:'\t\ttest_when_finished git checkout feature-branch &&\n' span_id:86) (Token id: Id.Lit_Chars val: '\t\techo dirty >>file3 &&\n' span_id: 87 ) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase$type --no-autostash unrelated-onto-branch\n' span_id: 88 ) (Token id:Id.Lit_Chars val:'\t' span_id:89) ) } ) (C {(test_expect_success)} { (DQ (rebase) ($ Id.VSub_DollarName '$type') (': dirty worktree, non-conflicting rebase') ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:103) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 104 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:105) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 106 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 107 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:108) (Token id: Id.Lit_Chars val: '\t\tgit rebase$type unrelated-onto-branch &&\n' span_id: 109 ) (Token id:Id.Lit_Chars val:'\t\tgrep unrelated file4 &&\n' span_id:110) (Token id: Id.Lit_Chars val: '\t\tgrep dirty file3 &&\n' span_id: 111 ) (Token id:Id.Lit_Chars val:'\t\tgit checkout feature-branch\n' span_id:112) (Token id:Id.Lit_Chars val:'\t' span_id:113) ) } ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': dirty index, non-conflicting rebase'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:127) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 128 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:129) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 130 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 131 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:132) (Token id:Id.Lit_Chars val:'\t\tgit add file3 &&\n' span_id:133) (Token id:Id.Lit_Chars val:'\t\tgit rebase$type unrelated-onto-branch &&\n' span_id:134) (Token id: Id.Lit_Chars val: '\t\tgrep unrelated file4 &&\n' span_id: 135 ) (Token id:Id.Lit_Chars val:'\t\tgrep dirty file3 &&\n' span_id:136) (Token id: Id.Lit_Chars val: '\t\tgit checkout feature-branch\n' span_id: 137 ) (Token id:Id.Lit_Chars val:'\t' span_id:138) ) } ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': conflicting rebase'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:152) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 153 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:154) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 155 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 156 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:157) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase$type related-onto-branch &&\n' span_id: 158 ) (Token id:Id.Lit_Chars val:'\t\ttest_path_is_file $dotest/autostash &&\n' span_id:159) (Token id: Id.Lit_Chars val: '\t\t! grep dirty file3 &&\n' span_id: 160 ) (Token id:Id.Lit_Chars val:'\t\trm -rf $dotest &&\n' span_id:161) (Token id: Id.Lit_Chars val: '\t\tgit reset --hard &&\n' span_id: 162 ) (Token id:Id.Lit_Chars val:'\t\tgit checkout feature-branch\n' span_id:163) (Token id:Id.Lit_Chars val:'\t' span_id:164) ) } ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': --continue'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:178) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 179 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:180) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 181 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 182 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:183) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase$type related-onto-branch &&\n' span_id: 184 ) (Token id:Id.Lit_Chars val:'\t\ttest_path_is_file $dotest/autostash &&\n' span_id:185) (Token id: Id.Lit_Chars val: '\t\t! grep dirty file3 &&\n' span_id: 186 ) (Token id:Id.Lit_Chars val:'\t\techo "conflicting-plus-goodbye" >file2 &&\n' span_id:187) (Token id:Id.Lit_Chars val:'\t\tgit add file2 &&\n' span_id:188) (Token id:Id.Lit_Chars val:'\t\tgit rebase --continue &&\n' span_id:189) (Token id: Id.Lit_Chars val: '\t\ttest_path_is_missing $dotest/autostash &&\n' span_id: 190 ) (Token id:Id.Lit_Chars val:'\t\tgrep dirty file3 &&\n' span_id:191) (Token id: Id.Lit_Chars val: '\t\tgit checkout feature-branch\n' span_id: 192 ) (Token id:Id.Lit_Chars val:'\t' span_id:193) ) } ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': --skip'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:207) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 208 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:209) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 210 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 211 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:212) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase$type related-onto-branch &&\n' span_id: 213 ) (Token id:Id.Lit_Chars val:'\t\ttest_path_is_file $dotest/autostash &&\n' span_id:214) (Token id: Id.Lit_Chars val: '\t\t! grep dirty file3 &&\n' span_id: 215 ) (Token id:Id.Lit_Chars val:'\t\tgit rebase --skip &&\n' span_id:216) (Token id: Id.Lit_Chars val: '\t\ttest_path_is_missing $dotest/autostash &&\n' span_id: 217 ) (Token id:Id.Lit_Chars val:'\t\tgrep dirty file3 &&\n' span_id:218) (Token id: Id.Lit_Chars val: '\t\tgit checkout feature-branch\n' span_id: 219 ) (Token id:Id.Lit_Chars val:'\t' span_id:220) ) } ) (C {(test_expect_success)} {(DQ (rebase) ($ Id.VSub_DollarName '$type') (': --abort'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:234) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 235 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:236) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 237 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 238 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >>file3 &&\n' span_id:239) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase$type related-onto-branch &&\n' span_id: 240 ) (Token id:Id.Lit_Chars val:'\t\ttest_path_is_file $dotest/autostash &&\n' span_id:241) (Token id: Id.Lit_Chars val: '\t\t! grep dirty file3 &&\n' span_id: 242 ) (Token id:Id.Lit_Chars val:'\t\tgit rebase --abort &&\n' span_id:243) (Token id: Id.Lit_Chars val: '\t\ttest_path_is_missing $dotest/autostash &&\n' span_id: 244 ) (Token id:Id.Lit_Chars val:'\t\tgrep dirty file3 &&\n' span_id:245) (Token id: Id.Lit_Chars val: '\t\tgit checkout feature-branch\n' span_id: 246 ) (Token id:Id.Lit_Chars val:'\t' span_id:247) ) } ) (C {(test_expect_success)} { (DQ (rebase) ($ Id.VSub_DollarName '$type') (': non-conflicting rebase, conflicting stash') ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:261) (Token id: Id.Lit_Chars val: '\t\ttest_config rebase.autostash true &&\n' span_id: 262 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:263) (Token id: Id.Lit_Chars val: '\t\tgit checkout -b rebased-feature-branch feature-branch &&\n' span_id: 264 ) (Token id: Id.Lit_Chars val: '\t\ttest_when_finished git branch -D rebased-feature-branch &&\n' span_id: 265 ) (Token id:Id.Lit_Chars val:'\t\techo dirty >file4 &&\n' span_id:266) (Token id:Id.Lit_Chars val:'\t\tgit add file4 &&\n' span_id:267) (Token id:Id.Lit_Chars val:'\t\tgit rebase$type unrelated-onto-branch &&\n' span_id:268) (Token id: Id.Lit_Chars val: '\t\ttest_path_is_missing $dotest &&\n' span_id: 269 ) (Token id:Id.Lit_Chars val:'\t\tgit reset --hard &&\n' span_id:270) (Token id: Id.Lit_Chars val: '\t\tgrep unrelated file4 &&\n' span_id: 271 ) (Token id:Id.Lit_Chars val:'\t\t! grep dirty file4 &&\n' span_id:272) (Token id: Id.Lit_Chars val: '\t\tgit checkout feature-branch &&\n' span_id: 273 ) (Token id:Id.Lit_Chars val:'\t\tgit stash pop &&\n' span_id:274) (Token id:Id.Lit_Chars val:'\t\tgrep dirty file4\n' span_id:275) (Token id:Id.Lit_Chars val:'\t' span_id:276) ) } ) ] ) ) (C {(test_expect_success)} {(DQ ('rebase: fast-forward rebase'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:289) (Token id: Id.Lit_Chars val: '\ttest_config rebase.autostash true &&\n' span_id: 290 ) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:291) (Token id: Id.Lit_Chars val: '\tgit checkout -b behind-feature-branch feature-branch~1 &&\n' span_id: 292 ) (Token id: Id.Lit_Chars val: '\ttest_when_finished git branch -D behind-feature-branch &&\n' span_id: 293 ) (Token id:Id.Lit_Chars val:'\techo dirty >>file1 &&\n' span_id:294) (Token id:Id.Lit_Chars val:'\tgit rebase feature-branch &&\n' span_id:295) (Token id:Id.Lit_Chars val:'\tgrep dirty file1 &&\n' span_id:296) (Token id:Id.Lit_Chars val:'\tgit checkout feature-branch\n' span_id:297) ) } ) (C {(test_expect_success)} {(DQ ('rebase: noop rebase'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:308) (Token id: Id.Lit_Chars val: '\ttest_config rebase.autostash true &&\n' span_id: 309 ) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:310) (Token id: Id.Lit_Chars val: '\tgit checkout -b same-feature-branch feature-branch &&\n' span_id: 311 ) (Token id:Id.Lit_Chars val:'\ttest_when_finished git branch -D same-feature-branch &&\n' span_id:312) (Token id:Id.Lit_Chars val:'\techo dirty >>file1 &&\n' span_id:313) (Token id:Id.Lit_Chars val:'\tgit rebase feature-branch &&\n' span_id:314) (Token id:Id.Lit_Chars val:'\tgrep dirty file1 &&\n' span_id:315) (Token id:Id.Lit_Chars val:'\tgit checkout feature-branch\n' span_id:316) ) } ) (C {(testrebase)} {(DQ )} {(.git/rebase-apply)}) (C {(testrebase)} {(DQ (' --merge'))} {(.git/rebase-merge)}) (C {(testrebase)} {(DQ (' --interactive'))} {(.git/rebase-merge)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'abort rebase -i with --autostash' span_id:347))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:351) (Token id: Id.Lit_Chars val: '\ttest_when_finished "git reset --hard" &&\n' span_id: 352 ) (Token id:Id.Lit_Chars val:'\techo uncommitted-content >file0 &&\n' span_id:353) (Token id:Id.Lit_Chars val:'\t(\n' span_id:354) (Token id:Id.Lit_Chars val:'\t\twrite_script abort-editor.sh <<-\\EOF &&\n' span_id:355) (Token id:Id.Lit_Chars val:'\t\t\techo >"$1"\n' span_id:356) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:357) (Token id: Id.Lit_Chars val: '\t\ttest_set_editor "$(pwd)/abort-editor.sh" &&\n' span_id: 358 ) (Token id:Id.Lit_Chars val:'\t\ttest_must_fail git rebase -i --autostash HEAD^ &&\n' span_id:359) (Token id:Id.Lit_Chars val:'\t\trm -f abort-editor.sh\n' span_id:360) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:361) (Token id: Id.Lit_Chars val: '\techo uncommitted-content >expected &&\n' span_id: 362 ) (Token id:Id.Lit_Chars val:'\ttest_cmp expected file0\n' span_id:363) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'restore autostash on editor failure' span_id:370))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:374) (Token id: Id.Lit_Chars val: '\ttest_when_finished "git reset --hard" &&\n' span_id: 375 ) (Token id:Id.Lit_Chars val:'\techo uncommitted-content >file0 &&\n' span_id:376) (Token id:Id.Lit_Chars val:'\t(\n' span_id:377) (Token id:Id.Lit_Chars val:'\t\ttest_set_editor "false" &&\n' span_id:378) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase -i --autostash HEAD^\n' span_id: 379 ) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:380) (Token id: Id.Lit_Chars val: '\techo uncommitted-content >expected &&\n' span_id: 381 ) (Token id:Id.Lit_Chars val:'\ttest_cmp expected file0\n' span_id:382) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'autostash is saved on editor failure with conflict' span_id: 389 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:393) (Token id: Id.Lit_Chars val: '\ttest_when_finished "git reset --hard" &&\n' span_id: 394 ) (Token id:Id.Lit_Chars val:'\techo uncommitted-content >file0 &&\n' span_id:395) (Token id:Id.Lit_Chars val:'\t(\n' span_id:396) (Token id:Id.Lit_Chars val:'\t\twrite_script abort-editor.sh <<-\\EOF &&\n' span_id:397) (Token id:Id.Lit_Chars val:'\t\t\techo conflicting-content >file0\n' span_id:398) (Token id:Id.Lit_Chars val:'\t\t\texit 1\n' span_id:399) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:400) (Token id:Id.Lit_Chars val:'\t\ttest_set_editor "$(pwd)/abort-editor.sh" &&\n' span_id:401) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail git rebase -i --autostash HEAD^ &&\n' span_id: 402 ) (Token id:Id.Lit_Chars val:'\t\trm -f abort-editor.sh\n' span_id:403) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:404) (Token id:Id.Lit_Chars val:'\techo conflicting-content >expected &&\n' span_id:405) (Token id:Id.Lit_Chars val:'\ttest_cmp expected file0 &&\n' span_id:406) (Token id:Id.Lit_Chars val:'\tgit checkout file0 &&\n' span_id:407) (Token id:Id.Lit_Chars val:'\tgit stash pop &&\n' span_id:408) (Token id:Id.Lit_Chars val:'\techo uncommitted-content >expected &&\n' span_id:409) (Token id:Id.Lit_Chars val:'\ttest_cmp expected file0\n' span_id:410) ) } ) (C {(test_done)}) ] )