#!/bin/sh # # Copyright (c) 2007 Johannes Sixt # global test_description := ''git update-index on filesystem w/o symlinks test. This tests that git update-index keeps the symbolic link property even if a plain file is in the working tree if core.symlinks is false.'' source ./test-lib.sh test_expect_success \ 'preparation' ' git config core.symlinks false && l=$(printf file | git hash-object -t blob -w --stdin) && echo "120000 $l symlink" | git update-index --index-info' test_expect_success \ 'modify the symbolic link' ' printf new-file > symlink && git update-index symlink' test_expect_success \ 'the index entry must still be a symbolic link' ' case "$(git ls-files --stage --cached symlink)" in 120000" "*symlink) echo pass;; *) echo fail; git ls-files --stage --cached symlink; (exit 1);; esac' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"git update-index on filesystem w/o symlinks test.\n"> <"\n"> <"This tests that git update-index keeps the symbolic link property\n"> <"even if a plain file is in the working tree if core.symlinks is false."> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"git config core.symlinks false &&\n"> <"l=$(printf file | git hash-object -t blob -w --stdin) &&\n"> <"echo \"120000 $l\tsymlink\" | git update-index --index-info"> ) } ) (C {(test_expect_success)} {(SQ <"modify the symbolic link">)} {(SQ <"\n"> <"printf new-file > symlink &&\n"> <"git update-index symlink">)} ) (C {(test_expect_success)} {(SQ <"the index entry must still be a symbolic link">)} { (SQ <"\n"> <"case \"$(git ls-files --stage --cached symlink)\" in\n"> <"120000\" \"*symlink) echo pass;;\n"> <"*) echo fail; git ls-files --stage --cached symlink; (exit 1);;\n"> ) } ) (C {(test_done)}) ] )