commit 88fb31d4fff7b0b2d49de132675aa871955ae6c4 from: Stefan Sperling date: Thu Jul 23 14:22:33 2020 UTC extend test_commit_symlink test case commit - e8863bdcc347433dd57e74d456115a6cb5d9953c commit + 88fb31d4fff7b0b2d49de132675aa871955ae6c4 blob - 26fadaaea8100147c52523e87fffd22258c0333a blob + f6bf52a3c60f518baf559ef3112a4086136ee414 --- regress/cmdline/commit.sh +++ regress/cmdline/commit.sh @@ -1031,7 +1031,55 @@ function test_commit_symlink { test_done "$testroot" "$ret" return 1 fi - test_done "$testroot" "0" + + (cd $testroot/wt && ln -sf beta alpha.link) + (cd $testroot/wt && ln -sfh gamma epsilon.link) + rm $testroot/wt/epsilon/beta.link + echo "this is a regular file" > $testroot/wt/epsilon/beta.link + (cd $testroot/wt && ln -sf .got/bar dotgotbar.link) + (cd $testroot/wt && got rm nonexistent.link > /dev/null) + (cd $testroot/wt && ln -sf gamma/delta zeta.link) + (cd $testroot/wt && ln -sf alpha new.link) + (cd $testroot/wt && got add new.link > /dev/null) + + (cd $testroot/wt && got commit -m 'test commit_symlink' > $testroot/stdout) + + local head_rev=`git_show_head $testroot/repo` + echo "A new.link" > $testroot/stdout.expected + echo "M alpha.link" >> $testroot/stdout.expected + echo "M epsilon/beta.link" >> $testroot/stdout.expected + echo "M epsilon.link" >> $testroot/stdout.expected + echo "D nonexistent.link" >> $testroot/stdout.expected + echo "Created commit $head_rev" >> $testroot/stdout.expected + + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + got tree -r $testroot/repo -c $head_rev -R > $testroot/stdout + cat > $testroot/stdout.expected < beta +beta +epsilon/ +epsilon/beta.link +epsilon/zeta +epsilon.link@ -> gamma +gamma/ +gamma/delta +new.link@ -> alpha +passwd.link@ -> /etc/passwd +EOF + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + fi + test_done "$testroot" "$ret" } function test_commit_fix_bad_symlink {