(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 assorted tests\n' span_id:15) (Token id:Id.Lit_Chars val:'\n' span_id:16) (Token id: Id.Lit_Chars val: 'This test runs git rebase and checks that the author information is not lost\n' span_id: 17 ) (Token id:Id.Lit_Chars val:'among other things.\n' span_id:18) ) } spids: [13] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_AUTHOR_NAME) op: assign_op.Equal rhs: {(author) (Id.Lit_Splice '@name')} spids: [26] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_AUTHOR_EMAIL) op: assign_op.Equal rhs: {(bogus) (Id.Lit_Splice '@email') (Id.Lit_Splice '@address')} spids: [30] ) ] ) (C {(export)} {(GIT_AUTHOR_NAME)} {(GIT_AUTHOR_EMAIL)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'prepare repository with topic branches' span_id:45))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:49) (Token id: Id.Lit_Chars val: '\tgit config core.logAllRefUpdates true &&\n' span_id: 50 ) (Token id:Id.Lit_Chars val:'\techo First >A &&\n' span_id:51) (Token id:Id.Lit_Chars val:'\tgit update-index --add A &&\n' span_id:52) (Token id:Id.Lit_Chars val:'\tgit commit -m "Add A." &&\n' span_id:53) (Token id:Id.Lit_Chars val:'\tgit checkout -b force-3way &&\n' span_id:54) (Token id:Id.Lit_Chars val:'\techo Dummy >Y &&\n' span_id:55) (Token id:Id.Lit_Chars val:'\tgit update-index --add Y &&\n' span_id:56) (Token id:Id.Lit_Chars val:'\tgit commit -m "Add Y." &&\n' span_id:57) (Token id:Id.Lit_Chars val:'\tgit checkout -b filemove &&\n' span_id:58) (Token id:Id.Lit_Chars val:'\tgit reset --soft master &&\n' span_id:59) (Token id:Id.Lit_Chars val:'\tmkdir D &&\n' span_id:60) (Token id:Id.Lit_Chars val:'\tgit mv A D/A &&\n' span_id:61) (Token id:Id.Lit_Chars val:'\tgit commit -m "Move A." &&\n' span_id:62) (Token id:Id.Lit_Chars val:'\tgit checkout -b my-topic-branch master &&\n' span_id:63) (Token id:Id.Lit_Chars val:'\techo Second >B &&\n' span_id:64) (Token id:Id.Lit_Chars val:'\tgit update-index --add B &&\n' span_id:65) (Token id:Id.Lit_Chars val:'\tgit commit -m "Add B." &&\n' span_id:66) (Token id:Id.Lit_Chars val:'\tgit checkout -f master &&\n' span_id:67) (Token id:Id.Lit_Chars val:'\techo Third >>A &&\n' span_id:68) (Token id:Id.Lit_Chars val:'\tgit update-index A &&\n' span_id:69) (Token id:Id.Lit_Chars val:'\tgit commit -m "Modify A." &&\n' span_id:70) (Token id:Id.Lit_Chars val:'\tgit checkout -b side my-topic-branch &&\n' span_id:71) (Token id:Id.Lit_Chars val:'\techo Side >>C &&\n' span_id:72) (Token id:Id.Lit_Chars val:'\tgit add C &&\n' span_id:73) (Token id:Id.Lit_Chars val:'\tgit commit -m "Add C" &&\n' span_id:74) (Token id:Id.Lit_Chars val:'\tgit checkout -f my-topic-branch &&\n' span_id:75) (Token id:Id.Lit_Chars val:'\tgit tag topic\n' span_id:76) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase on dirty worktree' span_id:83))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:87) (Token id:Id.Lit_Chars val:'\techo dirty >>A &&\n' span_id:88) (Token id:Id.Lit_Chars val:'\ttest_must_fail git rebase master\n' span_id:89) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase on dirty cache' span_id:96))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:100) (Token id:Id.Lit_Chars val:'\tgit add A &&\n' span_id:101) (Token id:Id.Lit_Chars val:'\ttest_must_fail git rebase master\n' span_id:102) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase against master' span_id:109))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:113) (Token id:Id.Lit_Chars val:'\tgit reset --hard HEAD &&\n' span_id:114) (Token id:Id.Lit_Chars val:'\tgit rebase master\n' span_id:115) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'rebase, with <onto> and <upstream> specified as :/quuxery' span_id: 122 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:126) (Token id: Id.Lit_Chars val: '\ttest_when_finished "git branch -D torebase" &&\n' span_id: 127 ) (Token id:Id.Lit_Chars val:'\tgit checkout -b torebase my-topic-branch^ &&\n' span_id:128) (Token id: Id.Lit_Chars val: '\tupstream=$(git rev-parse ":/Add B") &&\n' span_id: 129 ) (Token id:Id.Lit_Chars val:'\tonto=$(git rev-parse ":/Add A") &&\n' span_id:130) (Token id: Id.Lit_Chars val: '\tgit rebase --onto $onto $upstream &&\n' span_id: 131 ) (Token id:Id.Lit_Chars val:'\tgit reset --hard my-topic-branch^ &&\n' span_id:132) (Token id: Id.Lit_Chars val: '\tgit rebase --onto ":/Add A" ":/Add B" &&\n' span_id: 133 ) (Token id:Id.Lit_Chars val:'\tgit checkout my-topic-branch\n' span_id:134) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'the rebase operation should not have destroyed author information' span_id: 141 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:145) (Token id: Id.Lit_Chars val: '\t! (git log | grep "Author:" | grep "<>")\n' span_id: 146 ) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'the rebase operation should not have destroyed author information (2)' span_id: 153 ) ) } { (DQ ('\n') ('\tgit log -1 |\n') ("\tgrep 'Author: ") ($ Id.VSub_DollarName '$GIT_AUTHOR_NAME') (' <') ($ Id.VSub_DollarName '$GIT_AUTHOR_EMAIL') (">'\n") ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'HEAD was detached during rebase' span_id:170))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:174) (Token id: Id.Lit_Chars val: '\ttest $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})\n' span_id: 175 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase from ambiguous branch name' span_id:182))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:186) (Token id:Id.Lit_Chars val:'\tgit checkout -b topic side &&\n' span_id:187) (Token id:Id.Lit_Chars val:'\tgit rebase master\n' span_id:188) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase off of the previous branch using "-"' span_id:195))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:199) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:200) (Token id:Id.Lit_Chars val:'\tgit checkout HEAD^ &&\n' span_id:201) (Token id: Id.Lit_Chars val: '\tgit rebase @{-1} >expect.messages &&\n' span_id: 202 ) (Token id:Id.Lit_Chars val:'\tgit merge-base master HEAD >expect.forkpoint &&\n' span_id:203) (Token id:Id.Lit_Chars val:'\n' span_id:204) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:205) (Token id:Id.Lit_Chars val:'\tgit checkout HEAD^ &&\n' span_id:206) (Token id:Id.Lit_Chars val:'\tgit rebase - >actual.messages &&\n' span_id:207) (Token id: Id.Lit_Chars val: '\tgit merge-base master HEAD >actual.forkpoint &&\n' span_id: 208 ) (Token id:Id.Lit_Chars val:'\n' span_id:209) (Token id: Id.Lit_Chars val: '\ttest_cmp expect.forkpoint actual.forkpoint &&\n' span_id: 210 ) (Token id:Id.Lit_Chars val:'\t# the next one is dubious---we may want to say "-",\n' span_id:211) (Token id:Id.Lit_Chars val:'\t# instead of @{-1}, in the message\n' span_id:212) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect.messages actual.messages\n' span_id:213) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase a single mode change' span_id:220))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:224) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:225) (Token id:Id.Lit_Chars val:'\tgit branch -D topic &&\n' span_id:226) (Token id:Id.Lit_Chars val:'\techo 1 >X &&\n' span_id:227) (Token id:Id.Lit_Chars val:'\tgit add X &&\n' span_id:228) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:229) (Token id:Id.Lit_Chars val:'\tgit commit -m prepare &&\n' span_id:230) (Token id:Id.Lit_Chars val:'\tgit checkout -b modechange HEAD^ &&\n' span_id:231) (Token id:Id.Lit_Chars val:'\techo 1 >X &&\n' span_id:232) (Token id:Id.Lit_Chars val:'\tgit add X &&\n' span_id:233) (Token id:Id.Lit_Chars val:'\ttest_chmod +x A &&\n' span_id:234) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:235) (Token id:Id.Lit_Chars val:'\tgit commit -m modechange &&\n' span_id:236) (Token id:Id.Lit_Chars val:'\tGIT_TRACE=1 git rebase master\n' span_id:237) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase is not broken by diff.renames' span_id:244))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:248) (Token id:Id.Lit_Chars val:'\ttest_config diff.renames copies &&\n' span_id:249) (Token id:Id.Lit_Chars val:'\tgit checkout filemove &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\tGIT_TRACE=1 git rebase force-3way\n' span_id:251) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setup: recover' span_id:258))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:262) (Token id: Id.Lit_Chars val: '\ttest_might_fail git rebase --abort &&\n' span_id: 263 ) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:264) (Token id:Id.Lit_Chars val:'\tgit checkout modechange\n' span_id:265) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'Show verbose error when HEAD could not be detached' span_id: 272 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:276) (Token id:Id.Lit_Chars val:'\t>B &&\n' span_id:277) (Token id: Id.Lit_Chars val: '\ttest_must_fail git rebase topic 2>output.err >output.out &&\n' span_id: 278 ) (Token id: Id.Lit_Chars val: '\ttest_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err &&\n' span_id: 279 ) (Token id:Id.Lit_Chars val:'\ttest_i18ngrep B output.err\n' span_id:280) ) } ) (C {(rm)} {(-f)} {(B)}) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'fail when upstream arg is missing and not on branch' span_id: 293 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:297) (Token id:Id.Lit_Chars val:'\tgit checkout topic &&\n' span_id:298) (Token id:Id.Lit_Chars val:'\ttest_must_fail git rebase\n' span_id:299) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'fail when upstream arg is missing and not configured' span_id: 306 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:310) (Token id:Id.Lit_Chars val:'\tgit checkout -b no-config topic &&\n' span_id:311) (Token id:Id.Lit_Chars val:'\ttest_must_fail git rebase\n' span_id:312) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'default to common base in @{upstream}s reflog if no upstream arg' span_id: 319 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:323) (Token id: Id.Lit_Chars val: '\tgit checkout -b default-base master &&\n' span_id: 324 ) (Token id:Id.Lit_Chars val:'\tgit checkout -b default topic &&\n' span_id:325) (Token id: Id.Lit_Chars val: '\tgit config branch.default.remote . &&\n' span_id: 326 ) (Token id: Id.Lit_Chars val: '\tgit config branch.default.merge refs/heads/default-base &&\n' span_id: 327 ) (Token id:Id.Lit_Chars val:'\tgit rebase &&\n' span_id:328) (Token id: Id.Lit_Chars val: '\tgit rev-parse --verify default-base >expect &&\n' span_id: 329 ) (Token id:Id.Lit_Chars val:'\tgit rev-parse default~1 >actual &&\n' span_id:330) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual &&\n' span_id:331) (Token id:Id.Lit_Chars val:'\tgit checkout default-base &&\n' span_id:332) (Token id:Id.Lit_Chars val:'\tgit reset --hard HEAD^ &&\n' span_id:333) (Token id:Id.Lit_Chars val:'\tgit checkout default &&\n' span_id:334) (Token id:Id.Lit_Chars val:'\tgit rebase &&\n' span_id:335) (Token id:Id.Lit_Chars val:'\tgit rev-parse --verify default-base >expect &&\n' span_id:336) (Token id:Id.Lit_Chars val:'\tgit rev-parse default~1 >actual &&\n' span_id:337) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:338) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'cherry-picked commits and fork-point work together' span_id: 345 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:349) (Token id:Id.Lit_Chars val:'\tgit checkout default-base &&\n' span_id:350) (Token id:Id.Lit_Chars val:'\techo Amended >A &&\n' span_id:351) (Token id:Id.Lit_Chars val:'\tgit commit -a --no-edit --amend &&\n' span_id:352) (Token id:Id.Lit_Chars val:'\ttest_commit B B &&\n' span_id:353) (Token id:Id.Lit_Chars val:'\ttest_commit new_B B "New B" &&\n' span_id:354) (Token id:Id.Lit_Chars val:'\ttest_commit C C &&\n' span_id:355) (Token id:Id.Lit_Chars val:'\tgit checkout default &&\n' span_id:356) (Token id:Id.Lit_Chars val:'\tgit reset --hard default-base@{4} &&\n' span_id:357) (Token id:Id.Lit_Chars val:'\ttest_commit D D &&\n' span_id:358) (Token id:Id.Lit_Chars val:'\tgit cherry-pick -2 default-base^ &&\n' span_id:359) (Token id:Id.Lit_Chars val:'\ttest_commit final_B B "Final B" &&\n' span_id:360) (Token id:Id.Lit_Chars val:'\tgit rebase &&\n' span_id:361) (Token id:Id.Lit_Chars val:'\techo Amended >expect &&\n' span_id:362) (Token id:Id.Lit_Chars val:'\ttest_cmp A expect &&\n' span_id:363) (Token id:Id.Lit_Chars val:'\techo "Final B" >expect &&\n' span_id:364) (Token id:Id.Lit_Chars val:'\ttest_cmp B expect &&\n' span_id:365) (Token id:Id.Lit_Chars val:'\techo C >expect &&\n' span_id:366) (Token id:Id.Lit_Chars val:'\ttest_cmp C expect &&\n' span_id:367) (Token id:Id.Lit_Chars val:'\techo D >expect &&\n' span_id:368) (Token id:Id.Lit_Chars val:'\ttest_cmp D expect\n' span_id:369) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase -q is quiet' span_id:376))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:380) (Token id:Id.Lit_Chars val:'\tgit checkout -b quiet topic &&\n' span_id:381) (Token id:Id.Lit_Chars val:'\tgit rebase -q master >output.out 2>&1 &&\n' span_id:382) (Token id:Id.Lit_Chars val:'\ttest_must_be_empty output.out\n' span_id:383) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'Rebase a commit that sprinkles CRs in' span_id:390))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:394) (Token id:Id.Lit_Chars val:'\t(\n' span_id:395) (Token id:Id.Lit_Chars val:'\t\techo "One"\n' span_id:396) (Token id:Id.Lit_Chars val:'\t\techo "TwoQ"\n' span_id:397) (Token id:Id.Lit_Chars val:'\t\techo "Three"\n' span_id:398) (Token id:Id.Lit_Chars val:'\t\techo "FQur"\n' span_id:399) (Token id:Id.Lit_Chars val:'\t\techo "Five"\n' span_id:400) (Token id:Id.Lit_Chars val:'\t) | q_to_cr >CR &&\n' span_id:401) (Token id:Id.Lit_Chars val:'\tgit add CR &&\n' span_id:402) (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:403) (Token id:Id.Lit_Chars val:'\tgit commit -a -m "A file with a line with CR" &&\n' span_id:404) (Token id:Id.Lit_Chars val:'\tgit tag file-with-cr &&\n' span_id:405) (Token id:Id.Lit_Chars val:'\tgit checkout HEAD^0 &&\n' span_id:406) (Token id:Id.Lit_Chars val:'\tgit rebase --onto HEAD^^ HEAD^ &&\n' span_id:407) (Token id:Id.Lit_Chars val:'\tgit diff --exit-code file-with-cr:CR HEAD:CR\n' span_id:408) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase can copy notes' span_id:415))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:419) (Token id: Id.Lit_Chars val: '\tgit config notes.rewrite.rebase true &&\n' span_id: 420 ) (Token id:Id.Lit_Chars val:'\tgit config notes.rewriteRef "refs/notes/*" &&\n' span_id:421) (Token id:Id.Lit_Chars val:'\ttest_commit n1 &&\n' span_id:422) (Token id:Id.Lit_Chars val:'\ttest_commit n2 &&\n' span_id:423) (Token id:Id.Lit_Chars val:'\ttest_commit n3 &&\n' span_id:424) (Token id:Id.Lit_Chars val:'\tgit notes add -m"a note" n3 &&\n' span_id:425) (Token id:Id.Lit_Chars val:'\tgit rebase --onto n1 n2 &&\n' span_id:426) (Token id:Id.Lit_Chars val:'\ttest "a note" = "$(git notes show HEAD)"\n' span_id:427) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase -m can copy notes' span_id:434))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:438) (Token id:Id.Lit_Chars val:'\tgit reset --hard n3 &&\n' span_id:439) (Token id:Id.Lit_Chars val:'\tgit rebase -m --onto n1 n2 &&\n' span_id:440) (Token id: Id.Lit_Chars val: '\ttest "a note" = "$(git notes show HEAD)"\n' span_id: 441 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'rebase commit with an ancient timestamp' span_id:448))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:452) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:453) (Token id:Id.Lit_Chars val:'\n' span_id:454) (Token id: Id.Lit_Chars val: '\t>old.one && git add old.one && test_tick &&\n' span_id: 455 ) (Token id:Id.Lit_Chars val:'\tgit commit --date="@12345 +0400" -m "Old one" &&\n' span_id:456) (Token id: Id.Lit_Chars val: '\t>old.two && git add old.two && test_tick &&\n' span_id: 457 ) (Token id:Id.Lit_Chars val:'\tgit commit --date="@23456 +0500" -m "Old two" &&\n' span_id:458) (Token id: Id.Lit_Chars val: '\t>old.three && git add old.three && test_tick &&\n' span_id: 459 ) (Token id:Id.Lit_Chars val:'\tgit commit --date="@34567 +0600" -m "Old three" &&\n' span_id:460) (Token id:Id.Lit_Chars val:'\n' span_id:461) (Token id:Id.Lit_Chars val:'\tgit cat-file commit HEAD^^ >actual &&\n' span_id:462) (Token id: Id.Lit_Chars val: '\tgrep "author .* 12345 +0400$" actual &&\n' span_id: 463 ) (Token id:Id.Lit_Chars val:'\tgit cat-file commit HEAD^ >actual &&\n' span_id:464) (Token id: Id.Lit_Chars val: '\tgrep "author .* 23456 +0500$" actual &&\n' span_id: 465 ) (Token id:Id.Lit_Chars val:'\tgit cat-file commit HEAD >actual &&\n' span_id:466) (Token id: Id.Lit_Chars val: '\tgrep "author .* 34567 +0600$" actual &&\n' span_id: 467 ) (Token id:Id.Lit_Chars val:'\n' span_id:468) (Token id:Id.Lit_Chars val:'\tgit rebase --onto HEAD^^ HEAD^ &&\n' span_id:469) (Token id:Id.Lit_Chars val:'\n' span_id:470) (Token id:Id.Lit_Chars val:'\tgit cat-file commit HEAD >actual &&\n' span_id:471) (Token id:Id.Lit_Chars val:'\tgrep "author .* 34567 +0600$" actual\n' span_id:472) ) } ) (C {(test_done)}) ] )