#!/bin/sh global test_description := ''update-index and add refuse to add beyond symlinks'' source ./test-lib.sh test_expect_success SYMLINKS setup ' >a && mkdir b && ln -s b c && >c/d && git update-index --add a b/d ' test_expect_success SYMLINKS 'update-index --add beyond symlinks' ' test_must_fail git update-index --add c/d && ! ( git ls-files | grep c/d ) ' test_expect_success SYMLINKS 'add beyond symlinks' ' test_must_fail git add c/d && ! ( git ls-files | grep c/d ) ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"update-index and add refuse to add beyond symlinks">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SYMLINKS)} {(setup)} { (SQ <"\n"> <"\t>a &&\n"> <"\tmkdir b &&\n"> <"\tln -s b c &&\n"> <"\t>c/d &&\n"> <"\tgit update-index --add a b/d\n"> ) } ) (C {(test_expect_success)} {(SYMLINKS)} {(SQ <"update-index --add beyond symlinks">)} { (SQ <"\n"> <"\ttest_must_fail git update-index --add c/d &&\n"> <"\t! ( git ls-files | grep c/d )\n"> ) } ) (C {(test_expect_success)} {(SYMLINKS)} {(SQ <"add beyond symlinks">)} {(SQ <"\n"> <"\ttest_must_fail git add c/d &&\n"> <"\t! ( git ls-files | grep c/d )\n">)} ) (C {(test_done)}) ] )