#!/bin/sh # # Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas, # Thomas Nguy, Khoi Nguyen # Grenoble INP Ensimag # global test_description := ''git status advice'' source ./test-lib.sh source "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor test_expect_success 'prepare for conflicts' ' git config --global advice.statusuoption false && test_commit init main.txt init && git branch conflicts && test_commit on_master main.txt on_master && git checkout conflicts && test_commit on_conflicts main.txt on_conflicts ' test_expect_success 'status when conflicts unresolved' ' test_must_fail git merge master && cat >expected <<\EOF && On branch conflicts You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Unmerged paths: (use "git add ..." to mark resolution) both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status when conflicts resolved before commit' ' git reset --hard conflicts && test_must_fail git merge master && echo one >main.txt && git add main.txt && cat >expected <<\EOF && On branch conflicts All conflicts fixed but you are still merging. (use "git commit" to conclude merge) Changes to be committed: modified: main.txt Untracked files not listed (use -u option to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'prepare for rebase conflicts' ' git reset --hard master && git checkout -b rebase_conflicts && test_commit one_rebase main.txt one && test_commit two_rebase main.txt two && test_commit three_rebase main.txt three ' test_expect_success 'status when rebase in progress before resolving conflicts' ' test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD^^) && test_must_fail git rebase HEAD^ --onto HEAD^^ && cat >expected <..." to unstage) (use "git add ..." to mark resolution) both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status when rebase in progress before rebase --continue' ' git reset --hard rebase_conflicts && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD^^) && test_must_fail git rebase HEAD^ --onto HEAD^^ && echo three >main.txt && git add main.txt && cat >expected <..." to unstage) modified: main.txt Untracked files not listed (use -u option to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'prepare for rebase_i_conflicts' ' git reset --hard master && git checkout -b rebase_i_conflicts && test_commit one_unmerge main.txt one_unmerge && git branch rebase_i_conflicts_second && test_commit one_master main.txt one_master && git checkout rebase_i_conflicts_second && test_commit one_second main.txt one_second ' test_expect_success 'status during rebase -i when conflicts unresolved' ' test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short rebase_i_conflicts) && LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) && test_must_fail git rebase -i rebase_i_conflicts && cat >expected <..." to unstage) (use "git add ..." to mark resolution) both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status during rebase -i after resolving conflicts' ' git reset --hard rebase_i_conflicts_second && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short rebase_i_conflicts) && LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) && test_must_fail git rebase -i rebase_i_conflicts && git add main.txt && cat >expected <..." to unstage) modified: main.txt Untracked files not listed (use -u option to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status when rebasing -i in edit mode' ' git reset --hard master && git checkout -b rebase_i_edit && test_commit one_rebase_i main.txt one && test_commit two_rebase_i main.txt two && COMMIT2=$(git rev-parse --short rebase_i_edit) && test_commit three_rebase_i main.txt three && COMMIT3=$(git rev-parse --short rebase_i_edit) && FAKE_LINES="1 edit 2" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~2) && git rebase -i HEAD~2 && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status when splitting a commit' ' git reset --hard master && git checkout -b split_commit && test_commit one_split main.txt one && test_commit two_split main.txt two && COMMIT2=$(git rev-parse --short split_commit) && test_commit three_split main.txt three && COMMIT3=$(git rev-parse --short split_commit) && test_commit four_split main.txt four && COMMIT4=$(git rev-parse --short split_commit) && FAKE_LINES="1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git reset HEAD^ && cat >expected <..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status after editing the last commit with --amend during a rebase -i' ' git reset --hard master && git checkout -b amend_last && test_commit one_amend main.txt one && test_commit two_amend main.txt two && test_commit three_amend main.txt three && COMMIT3=$(git rev-parse --short amend_last) && test_commit four_amend main.txt four && COMMIT4=$(git rev-parse --short amend_last) && FAKE_LINES="1 2 edit 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git commit --amend -m "foo" && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'prepare for several edits' ' git reset --hard master && git checkout -b several_edits && test_commit one_edits main.txt one && test_commit two_edits main.txt two && test_commit three_edits main.txt three && test_commit four_edits main.txt four ' test_expect_success 'status: (continue first edit) second edit' ' FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git rebase --continue && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: (continue first edit) second edit and split' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git rebase --continue && git reset HEAD^ && cat >expected <..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status: (continue first edit) second edit and amend' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git rebase --continue && git commit --amend -m "foo" && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: (amend first edit) second edit' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git commit --amend -m "a" && git rebase --continue && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: (amend first edit) second edit and split' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~3) && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && git rebase -i HEAD~3 && git commit --amend -m "b" && git rebase --continue && git reset HEAD^ && cat >expected <..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status: (amend first edit) second edit and amend' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git commit --amend -m "c" && git rebase --continue && git commit --amend -m "d" && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: (split first edit) second edit' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git reset HEAD^ && git add main.txt && git commit -m "e" && git rebase --continue && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: (split first edit) second edit and split' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git reset HEAD^ && git add main.txt && git commit --amend -m "f" && git rebase --continue && git reset HEAD^ && cat >expected <..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status: (split first edit) second edit and amend' ' git reset --hard several_edits && FAKE_LINES="edit 1 edit 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && COMMIT2=$(git rev-parse --short several_edits^^) && COMMIT3=$(git rev-parse --short several_edits^) && COMMIT4=$(git rev-parse --short several_edits) && ONTO=$(git rev-parse --short HEAD~3) && git rebase -i HEAD~3 && git reset HEAD^ && git add main.txt && git commit --amend -m "g" && git rebase --continue && git commit --amend -m "h" && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'prepare am_session' ' git reset --hard master && git checkout -b am_session && test_commit one_am one.txt "one" && test_commit two_am two.txt "two" && test_commit three_am three.txt "three" ' test_expect_success 'status in an am session: file already exists' ' git checkout -b am_already_exists && test_when_finished "rm Maildir/* && git am --abort" && git format-patch -1 -oMaildir && test_must_fail git am Maildir/*.patch && cat >expected <<\EOF && On branch am_already_exists You are in the middle of an am session. (fix conflicts and then run "git am --continue") (use "git am --skip" to skip this patch) (use "git am --abort" to restore the original branch) nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status in an am session: file does not exist' ' git reset --hard am_session && git checkout -b am_not_exists && git rm three.txt && git commit -m "delete three.txt" && test_when_finished "rm Maildir/* && git am --abort" && git format-patch -1 -oMaildir && test_must_fail git am Maildir/*.patch && cat >expected <<\EOF && On branch am_not_exists You are in the middle of an am session. (fix conflicts and then run "git am --continue") (use "git am --skip" to skip this patch) (use "git am --abort" to restore the original branch) nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status in an am session: empty patch' ' git reset --hard am_session && git checkout -b am_empty && test_when_finished "rm Maildir/* && git am --abort" && git format-patch -3 -oMaildir && git rm one.txt two.txt three.txt && git commit -m "delete all am_empty" && echo error >Maildir/0002-two_am.patch && test_must_fail git am Maildir/*.patch && cat >expected <<\EOF && On branch am_empty You are in the middle of an am session. The current patch is empty. (use "git am --skip" to skip this patch) (use "git am --abort" to restore the original branch) nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status when bisecting' ' git reset --hard master && git checkout -b bisect && test_commit one_bisect main.txt one && test_commit two_bisect main.txt two && test_commit three_bisect main.txt three && test_when_finished "git bisect reset" && git bisect start && git bisect bad && git bisect good one_bisect && TGT=$(git rev-parse --short two_bisect) && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status when rebase conflicts with statushints disabled' ' git reset --hard master && git checkout -b statushints_disabled && test_when_finished "git config --local advice.statushints true" && git config --local advice.statushints false && test_commit one_statushints main.txt one && test_commit two_statushints main.txt two && test_commit three_statushints main.txt three && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD^^) && test_must_fail git rebase HEAD^ --onto HEAD^^ && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'prepare for cherry-pick conflicts' ' git reset --hard master && git checkout -b cherry_branch && test_commit one_cherry main.txt one && test_commit two_cherries main.txt two && git checkout -b cherry_branch_second && test_commit second_cherry main.txt second && git checkout cherry_branch && test_commit three_cherries main.txt three ' test_expect_success 'status when cherry-picking before resolving conflicts' ' test_when_finished "git cherry-pick --abort" && test_must_fail git cherry-pick cherry_branch_second && TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) && cat >expected <..." to mark resolution) both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status when cherry-picking after resolving conflicts' ' git reset --hard cherry_branch && test_when_finished "git cherry-pick --abort" && test_must_fail git cherry-pick cherry_branch_second && TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) && echo end >main.txt && git add main.txt && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status showing detached at and from a tag' ' test_commit atag tagging && git checkout atag && cat >expected <<\EOF && HEAD detached at atag nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual && git reset --hard HEAD^ && cat >expected <<\EOF && HEAD detached from atag nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status while reverting commit (conflicts)' ' git checkout master && echo before >to-revert.txt && test_commit before to-revert.txt && echo old >to-revert.txt && test_commit old to-revert.txt && echo new >to-revert.txt && test_commit new to-revert.txt && TO_REVERT=$(git rev-parse --short HEAD^) && test_must_fail git revert $TO_REVERT && cat >expected <..." to unstage) (use "git add ..." to mark resolution) both modified: to-revert.txt no changes added to commit (use "git add" and/or "git commit -a") EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status while reverting commit (conflicts resolved)' ' echo reverted >to-revert.txt && git add to-revert.txt && cat >expected <..." to unstage) modified: to-revert.txt Untracked files not listed (use -u option to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'status after reverting commit' ' git revert --continue && cat >expected <<\EOF && On branch master nothing to commit (use -u to show untracked files) EOF git status --untracked-files=no >actual && test_i18ncmp expected actual ' test_expect_success 'prepare for different number of commits rebased' ' git reset --hard master && git checkout -b several_commits && test_commit one_commit main.txt one && test_commit two_commit main.txt two && test_commit three_commit main.txt three && test_commit four_commit main.txt four ' test_expect_success 'status: one command done nothing remaining' ' FAKE_LINES="exec_exit_15" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~3) && test_must_fail git rebase -i HEAD~3 && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: two commands done with some white lines in done file' ' FAKE_LINES="1 > exec_exit_15 2 3" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~3) && COMMIT4=$(git rev-parse --short HEAD) && COMMIT3=$(git rev-parse --short HEAD^) && COMMIT2=$(git rev-parse --short HEAD^^) && test_must_fail git rebase -i HEAD~3 && cat >expected <actual && test_i18ncmp expected actual ' test_expect_success 'status: two remaining commands with some white lines in todo file' ' FAKE_LINES="1 2 exec_exit_15 3 > 4" && export FAKE_LINES && test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD~4) && COMMIT4=$(git rev-parse --short HEAD) && COMMIT3=$(git rev-parse --short HEAD^) && COMMIT2=$(git rev-parse --short HEAD^^) && test_must_fail git rebase -i HEAD~4 && cat >expected <actual && test_i18ncmp expected actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git status advice">)} spids: [19] ) ] spids: [19] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/lib-rebase.sh)}) (C {(set_fake_editor)}) (C {(test_expect_success)} {(SQ <"prepare for conflicts">)} { (SQ <"\n"> <"\tgit config --global advice.statusuoption false &&\n"> <"\ttest_commit init main.txt init &&\n"> <"\tgit branch conflicts &&\n"> <"\ttest_commit on_master main.txt on_master &&\n"> <"\tgit checkout conflicts &&\n"> <"\ttest_commit on_conflicts main.txt on_conflicts\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when conflicts unresolved">)} { (SQ <"\n"> <"\ttest_must_fail git merge master &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch conflicts\n"> <"You have unmerged paths.\n"> <" (fix conflicts and run \"git commit\")\n"> <" (use \"git merge --abort\" to abort the merge)\n"> <"\n"> <"Unmerged paths:\n"> <" (use \"git add ...\" to mark resolution)\n"> <"\n"> <"\tboth modified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when conflicts resolved before commit">)} { (SQ <"\n"> <"\tgit reset --hard conflicts &&\n"> <"\ttest_must_fail git merge master &&\n"> <"\techo one >main.txt &&\n"> <"\tgit add main.txt &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch conflicts\n"> <"All conflicts fixed but you are still merging.\n"> <" (use \"git commit\" to conclude merge)\n"> <"\n"> <"Changes to be committed:\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"Untracked files not listed (use -u option to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare for rebase conflicts">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b rebase_conflicts &&\n"> <"\ttest_commit one_rebase main.txt one &&\n"> <"\ttest_commit two_rebase main.txt two &&\n"> <"\ttest_commit three_rebase main.txt three\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when rebase in progress before resolving conflicts">)} { (SQ <"\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD^^) &&\n"> <"\ttest_must_fail git rebase HEAD^ --onto HEAD^^ &&\n"> <"\tcat >expected < <"rebase in progress; onto $ONTO\n"> <"You are currently rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (fix conflicts and then run \"git rebase --continue\")\n"> <" (use \"git rebase --skip\" to skip this patch)\n"> <" (use \"git rebase --abort\" to check out the original branch)\n"> <"\n"> <"Unmerged paths:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <" (use \"git add ...\" to mark resolution)\n"> <"\n"> <"\tboth modified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when rebase in progress before rebase --continue">)} { (SQ <"\n"> <"\tgit reset --hard rebase_conflicts &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD^^) &&\n"> <"\ttest_must_fail git rebase HEAD^ --onto HEAD^^ &&\n"> <"\techo three >main.txt &&\n"> <"\tgit add main.txt &&\n"> <"\tcat >expected < <"rebase in progress; onto $ONTO\n"> <"You are currently rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (all conflicts fixed: run \"git rebase --continue\")\n"> <"\n"> <"Changes to be committed:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"Untracked files not listed (use -u option to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare for rebase_i_conflicts">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b rebase_i_conflicts &&\n"> <"\ttest_commit one_unmerge main.txt one_unmerge &&\n"> <"\tgit branch rebase_i_conflicts_second &&\n"> <"\ttest_commit one_master main.txt one_master &&\n"> <"\tgit checkout rebase_i_conflicts_second &&\n"> <"\ttest_commit one_second main.txt one_second\n"> ) } ) (C {(test_expect_success)} {(SQ <"status during rebase -i when conflicts unresolved">)} { (SQ <"\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n"> <"\tLAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&\n"> <"\ttest_must_fail git rebase -i rebase_i_conflicts &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last command done (1 command done):\n"> <" pick $LAST_COMMIT one_second\n"> <"No commands remaining.\n"> <"You are currently rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (fix conflicts and then run \"git rebase --continue\")\n"> <" (use \"git rebase --skip\" to skip this patch)\n"> <" (use \"git rebase --abort\" to check out the original branch)\n"> <"\n"> <"Unmerged paths:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <" (use \"git add ...\" to mark resolution)\n"> <"\n"> <"\tboth modified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status during rebase -i after resolving conflicts">)} { (SQ <"\n"> <"\tgit reset --hard rebase_i_conflicts_second &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n"> <"\tLAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&\n"> <"\ttest_must_fail git rebase -i rebase_i_conflicts &&\n"> <"\tgit add main.txt &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last command done (1 command done):\n"> <" pick $LAST_COMMIT one_second\n"> <"No commands remaining.\n"> <"You are currently rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (all conflicts fixed: run \"git rebase --continue\")\n"> <"\n"> <"Changes to be committed:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"Untracked files not listed (use -u option to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when rebasing -i in edit mode">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b rebase_i_edit &&\n"> <"\ttest_commit one_rebase_i main.txt one &&\n"> <"\ttest_commit two_rebase_i main.txt two &&\n"> <"\tCOMMIT2=$(git rev-parse --short rebase_i_edit) &&\n"> <"\ttest_commit three_rebase_i main.txt three &&\n"> <"\tCOMMIT3=$(git rev-parse --short rebase_i_edit) &&\n"> <"\tFAKE_LINES=\"1 edit 2\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~2) &&\n"> <"\tgit rebase -i HEAD~2 &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" pick $COMMIT2 two_rebase_i\n"> <" edit $COMMIT3 three_rebase_i\n"> <"No commands remaining.\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when splitting a commit">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b split_commit &&\n"> <"\ttest_commit one_split main.txt one &&\n"> <"\ttest_commit two_split main.txt two &&\n"> <"\tCOMMIT2=$(git rev-parse --short split_commit) &&\n"> <"\ttest_commit three_split main.txt three &&\n"> <"\tCOMMIT3=$(git rev-parse --short split_commit) &&\n"> <"\ttest_commit four_split main.txt four &&\n"> <"\tCOMMIT4=$(git rev-parse --short split_commit) &&\n"> <"\tFAKE_LINES=\"1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" pick $COMMIT2 two_split\n"> <" edit $COMMIT3 three_split\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_split\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently splitting a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (Once your working directory is clean, run \"git rebase --continue\")\n"> <"\n"> <"Changes not staged for commit:\n"> <" (use \"git add ...\" to update what will be committed)\n"> <" (use \"git checkout -- ...\" to discard changes in working directory)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status after editing the last commit with --amend during a rebase -i">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b amend_last &&\n"> <"\ttest_commit one_amend main.txt one &&\n"> <"\ttest_commit two_amend main.txt two &&\n"> <"\ttest_commit three_amend main.txt three &&\n"> <"\tCOMMIT3=$(git rev-parse --short amend_last) &&\n"> <"\ttest_commit four_amend main.txt four &&\n"> <"\tCOMMIT4=$(git rev-parse --short amend_last) &&\n"> <"\tFAKE_LINES=\"1 2 edit 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit commit --amend -m \"foo\" &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (3 commands done):\n"> <" pick $COMMIT3 three_amend\n"> <" edit $COMMIT4 four_amend\n"> <" (see more in file .git/rebase-merge/done)\n"> <"No commands remaining.\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare for several edits">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b several_edits &&\n"> <"\ttest_commit one_edits main.txt one &&\n"> <"\ttest_commit two_edits main.txt two &&\n"> <"\ttest_commit three_edits main.txt three &&\n"> <"\ttest_commit four_edits main.txt four\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (continue first edit) second edit">)} { (SQ <"\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit rebase --continue &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (continue first edit) second edit and split">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently splitting a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (Once your working directory is clean, run \"git rebase --continue\")\n"> <"\n"> <"Changes not staged for commit:\n"> <" (use \"git add ...\" to update what will be committed)\n"> <" (use \"git checkout -- ...\" to discard changes in working directory)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (continue first edit) second edit and amend">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit commit --amend -m \"foo\" &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (amend first edit) second edit">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit commit --amend -m \"a\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (amend first edit) second edit and split">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit commit --amend -m \"b\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently splitting a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (Once your working directory is clean, run \"git rebase --continue\")\n"> <"\n"> <"Changes not staged for commit:\n"> <" (use \"git add ...\" to update what will be committed)\n"> <" (use \"git checkout -- ...\" to discard changes in working directory)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (amend first edit) second edit and amend">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit commit --amend -m \"c\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit commit --amend -m \"d\" &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (split first edit) second edit">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tgit add main.txt &&\n"> <"\tgit commit -m \"e\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (split first edit) second edit and split">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tgit add main.txt &&\n"> <"\tgit commit --amend -m \"f\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently splitting a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (Once your working directory is clean, run \"git rebase --continue\")\n"> <"\n"> <"Changes not staged for commit:\n"> <" (use \"git add ...\" to update what will be committed)\n"> <" (use \"git checkout -- ...\" to discard changes in working directory)\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: (split first edit) second edit and amend">)} { (SQ <"\n"> <"\tgit reset --hard several_edits &&\n"> <"\tFAKE_LINES=\"edit 1 edit 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tCOMMIT2=$(git rev-parse --short several_edits^^) &&\n"> <"\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n"> <"\tCOMMIT4=$(git rev-parse --short several_edits) &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tgit rebase -i HEAD~3 &&\n"> <"\tgit reset HEAD^ &&\n"> <"\tgit add main.txt &&\n"> <"\tgit commit --amend -m \"g\" &&\n"> <"\tgit rebase --continue &&\n"> <"\tgit commit --amend -m \"h\" &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" edit $COMMIT2 two_edits\n"> <" edit $COMMIT3 three_edits\n"> <"Next command to do (1 remaining command):\n"> <" pick $COMMIT4 four_edits\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare am_session">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b am_session &&\n"> <"\ttest_commit one_am one.txt \"one\" &&\n"> <"\ttest_commit two_am two.txt \"two\" &&\n"> <"\ttest_commit three_am three.txt \"three\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"status in an am session: file already exists">)} { (SQ <"\n"> <"\tgit checkout -b am_already_exists &&\n"> <"\ttest_when_finished \"rm Maildir/* && git am --abort\" &&\n"> <"\tgit format-patch -1 -oMaildir &&\n"> <"\ttest_must_fail git am Maildir/*.patch &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch am_already_exists\n"> <"You are in the middle of an am session.\n"> <" (fix conflicts and then run \"git am --continue\")\n"> <" (use \"git am --skip\" to skip this patch)\n"> <" (use \"git am --abort\" to restore the original branch)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status in an am session: file does not exist">)} { (SQ <"\n"> <"\tgit reset --hard am_session &&\n"> <"\tgit checkout -b am_not_exists &&\n"> <"\tgit rm three.txt &&\n"> <"\tgit commit -m \"delete three.txt\" &&\n"> <"\ttest_when_finished \"rm Maildir/* && git am --abort\" &&\n"> <"\tgit format-patch -1 -oMaildir &&\n"> <"\ttest_must_fail git am Maildir/*.patch &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch am_not_exists\n"> <"You are in the middle of an am session.\n"> <" (fix conflicts and then run \"git am --continue\")\n"> <" (use \"git am --skip\" to skip this patch)\n"> <" (use \"git am --abort\" to restore the original branch)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status in an am session: empty patch">)} { (SQ <"\n"> <"\tgit reset --hard am_session &&\n"> <"\tgit checkout -b am_empty &&\n"> <"\ttest_when_finished \"rm Maildir/* && git am --abort\" &&\n"> <"\tgit format-patch -3 -oMaildir &&\n"> <"\tgit rm one.txt two.txt three.txt &&\n"> <"\tgit commit -m \"delete all am_empty\" &&\n"> <"\techo error >Maildir/0002-two_am.patch &&\n"> <"\ttest_must_fail git am Maildir/*.patch &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch am_empty\n"> <"You are in the middle of an am session.\n"> <"The current patch is empty.\n"> <" (use \"git am --skip\" to skip this patch)\n"> <" (use \"git am --abort\" to restore the original branch)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when bisecting">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b bisect &&\n"> <"\ttest_commit one_bisect main.txt one &&\n"> <"\ttest_commit two_bisect main.txt two &&\n"> <"\ttest_commit three_bisect main.txt three &&\n"> <"\ttest_when_finished \"git bisect reset\" &&\n"> <"\tgit bisect start &&\n"> <"\tgit bisect bad &&\n"> <"\tgit bisect good one_bisect &&\n"> <"\tTGT=$(git rev-parse --short two_bisect) &&\n"> <"\tcat >expected < <"HEAD detached at $TGT\n"> <"You are currently bisecting, started from branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git bisect reset\" to get back to the original branch)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when rebase conflicts with statushints disabled">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b statushints_disabled &&\n"> <"\ttest_when_finished \"git config --local advice.statushints true\" &&\n"> <"\tgit config --local advice.statushints false &&\n"> <"\ttest_commit one_statushints main.txt one &&\n"> <"\ttest_commit two_statushints main.txt two &&\n"> <"\ttest_commit three_statushints main.txt three &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD^^) &&\n"> <"\ttest_must_fail git rebase HEAD^ --onto HEAD^^ &&\n"> <"\tcat >expected < <"rebase in progress; onto $ONTO\n"> <"You are currently rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <"\n"> <"Unmerged paths:\n"> <"\tboth modified: main.txt\n"> <"\n"> <"no changes added to commit\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare for cherry-pick conflicts">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b cherry_branch &&\n"> <"\ttest_commit one_cherry main.txt one &&\n"> <"\ttest_commit two_cherries main.txt two &&\n"> <"\tgit checkout -b cherry_branch_second &&\n"> <"\ttest_commit second_cherry main.txt second &&\n"> <"\tgit checkout cherry_branch &&\n"> <"\ttest_commit three_cherries main.txt three\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when cherry-picking before resolving conflicts">)} { (SQ <"\n"> <"\ttest_when_finished \"git cherry-pick --abort\" &&\n"> <"\ttest_must_fail git cherry-pick cherry_branch_second &&\n"> <"\tTO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&\n"> <"\tcat >expected < <"On branch cherry_branch\n"> <"You are currently cherry-picking commit $TO_CHERRY_PICK.\n"> <" (fix conflicts and run \"git cherry-pick --continue\")\n"> <" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)\n"> <"\n"> <"Unmerged paths:\n"> <" (use \"git add ...\" to mark resolution)\n"> <"\n"> <"\tboth modified: main.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status when cherry-picking after resolving conflicts">)} { (SQ <"\n"> <"\tgit reset --hard cherry_branch &&\n"> <"\ttest_when_finished \"git cherry-pick --abort\" &&\n"> <"\ttest_must_fail git cherry-pick cherry_branch_second &&\n"> <"\tTO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&\n"> <"\techo end >main.txt &&\n"> <"\tgit add main.txt &&\n"> <"\tcat >expected < <"On branch cherry_branch\n"> <"You are currently cherry-picking commit $TO_CHERRY_PICK.\n"> <" (all conflicts fixed: run \"git cherry-pick --continue\")\n"> <" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)\n"> <"\n"> <"Changes to be committed:\n"> <"\n"> <"\tmodified: main.txt\n"> <"\n"> <"Untracked files not listed (use -u option to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status showing detached at and from a tag">)} { (SQ <"\n"> <"\ttest_commit atag tagging &&\n"> <"\tgit checkout atag &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"HEAD detached at atag\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual &&\n"> <"\n"> <"\tgit reset --hard HEAD^ &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"HEAD detached from atag\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status while reverting commit (conflicts)">)} { (SQ <"\n"> <"\tgit checkout master &&\n"> <"\techo before >to-revert.txt &&\n"> <"\ttest_commit before to-revert.txt &&\n"> <"\techo old >to-revert.txt &&\n"> <"\ttest_commit old to-revert.txt &&\n"> <"\techo new >to-revert.txt &&\n"> <"\ttest_commit new to-revert.txt &&\n"> <"\tTO_REVERT=$(git rev-parse --short HEAD^) &&\n"> <"\ttest_must_fail git revert $TO_REVERT &&\n"> <"\tcat >expected < <"On branch master\n"> <"You are currently reverting commit $TO_REVERT.\n"> <" (fix conflicts and run \"git revert --continue\")\n"> <" (use \"git revert --abort\" to cancel the revert operation)\n"> <"\n"> <"Unmerged paths:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <" (use \"git add ...\" to mark resolution)\n"> <"\n"> <"\tboth modified: to-revert.txt\n"> <"\n"> <"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status while reverting commit (conflicts resolved)">)} { (SQ <"\n"> <"\techo reverted >to-revert.txt &&\n"> <"\tgit add to-revert.txt &&\n"> <"\tcat >expected < <"On branch master\n"> <"You are currently reverting commit $TO_REVERT.\n"> <" (all conflicts fixed: run \"git revert --continue\")\n"> <" (use \"git revert --abort\" to cancel the revert operation)\n"> <"\n"> <"Changes to be committed:\n"> <" (use \"git reset HEAD ...\" to unstage)\n"> <"\n"> <"\tmodified: to-revert.txt\n"> <"\n"> <"Untracked files not listed (use -u option to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status after reverting commit">)} { (SQ <"\n"> <"\tgit revert --continue &&\n"> <"\tcat >expected <<\\EOF &&\n"> <"On branch master\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"prepare for different number of commits rebased">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout -b several_commits &&\n"> <"\ttest_commit one_commit main.txt one &&\n"> <"\ttest_commit two_commit main.txt two &&\n"> <"\ttest_commit three_commit main.txt three &&\n"> <"\ttest_commit four_commit main.txt four\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: one command done nothing remaining">)} { (SQ <"\n"> <"\tFAKE_LINES=\"exec_exit_15\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\ttest_must_fail git rebase -i HEAD~3 &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last command done (1 command done):\n"> <" exec exit 15\n"> <"No commands remaining.\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: two commands done with some white lines in done file">)} { (SQ <"\n"> <"\tFAKE_LINES=\"1 > exec_exit_15 2 3\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~3) &&\n"> <"\tCOMMIT4=$(git rev-parse --short HEAD) &&\n"> <"\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n"> <"\tCOMMIT2=$(git rev-parse --short HEAD^^) &&\n"> <"\ttest_must_fail git rebase -i HEAD~3 &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (2 commands done):\n"> <" pick $COMMIT2 two_commit\n"> <" exec exit 15\n"> <"Next commands to do (2 remaining commands):\n"> <" pick $COMMIT3 three_commit\n"> <" pick $COMMIT4 four_commit\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"status: two remaining commands with some white lines in todo file">)} { (SQ <"\n"> <"\tFAKE_LINES=\"1 2 exec_exit_15 3 > 4\" &&\n"> <"\texport FAKE_LINES &&\n"> <"\ttest_when_finished \"git rebase --abort\" &&\n"> <"\tONTO=$(git rev-parse --short HEAD~4) &&\n"> <"\tCOMMIT4=$(git rev-parse --short HEAD) &&\n"> <"\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n"> <"\tCOMMIT2=$(git rev-parse --short HEAD^^) &&\n"> <"\ttest_must_fail git rebase -i HEAD~4 &&\n"> <"\tcat >expected < <"interactive rebase in progress; onto $ONTO\n"> <"Last commands done (3 commands done):\n"> <" pick $COMMIT2 two_commit\n"> <" exec exit 15\n"> <" (see more in file .git/rebase-merge/done)\n"> <"Next commands to do (2 remaining commands):\n"> <" pick $COMMIT3 three_commit\n"> <" pick $COMMIT4 four_commit\n"> <" (use \"git rebase --edit-todo\" to view and edit)\n"> <"You are currently editing a commit while rebasing branch "> ) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <" on ">) (EscapedLiteralPart token:) (SQ <"$ONTO">) (EscapedLiteralPart token:) (SQ <".\n"> <" (use \"git commit --amend\" to amend the current commit)\n"> <" (use \"git rebase --continue\" once you are satisfied with your changes)\n"> <"\n"> <"nothing to commit (use -u to show untracked files)\n"> <"EOF\n"> <"\tgit status --untracked-files=no >actual &&\n"> <"\ttest_i18ncmp expected actual\n"> ) } ) (C {(test_done)}) ] )