#!/bin/sh global test_description := ''git update-index --assume-unchanged test. '' source ./test-lib.sh test_expect_success 'setup' \ ': >file && git add file && git commit -m initial && git branch other && echo upstream >file && git add file && git commit -m upstream' test_expect_success 'do not switch branches with dirty file' \ 'git reset --hard && git checkout other && echo dirt >file && git update-index --assume-unchanged file && test_must_fail git checkout master' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git update-index --assume-unchanged test.\n">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <": >file &&\n"> <"\t git add file &&\n"> <"\t git commit -m initial &&\n"> <"\t git branch other &&\n"> <"\t echo upstream >file &&\n"> <"\t git add file &&\n"> <"\t git commit -m upstream"> ) } ) (C {(test_expect_success)} {(SQ <"do not switch branches with dirty file">)} { (SQ <"git reset --hard &&\n"> <"\t git checkout other &&\n"> <"\t echo dirt >file &&\n"> <"\t git update-index --assume-unchanged file &&\n"> <"\t test_must_fail git checkout master"> ) } ) (C {(test_done)}) ] )