#!/bin/sh global test_description := ''checkout should leave clean stat info'' source ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git update-index --add world && git commit -m initial && git branch side && echo goodbye >world && git update-index --add world && git commit -m second ' test_expect_success 'branch switching' ' git reset --hard && test "$(git diff-files --raw)" = "" && git checkout master && test "$(git diff-files --raw)" = "" && git checkout side && test "$(git diff-files --raw)" = "" && git checkout master && test "$(git diff-files --raw)" = "" ' test_expect_success 'path checkout' ' git reset --hard && test "$(git diff-files --raw)" = "" && git checkout master world && test "$(git diff-files --raw)" = "" && git checkout side world && test "$(git diff-files --raw)" = "" && git checkout master world && test "$(git diff-files --raw)" = "" ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"checkout should leave clean stat info">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"\n"> <"\techo hello >world &&\n"> <"\tgit update-index --add world &&\n"> <"\tgit commit -m initial &&\n"> <"\tgit branch side &&\n"> <"\techo goodbye >world &&\n"> <"\tgit update-index --add world &&\n"> <"\tgit commit -m second\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"branch switching">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout side &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\"\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"path checkout">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout master world &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout side world &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\" &&\n"> <"\n"> <"\tgit checkout master world &&\n"> <"\ttest \"$(git diff-files --raw)\" = \"\"\n"> <"\n"> ) } ) (C {(test_done)}) ] )