commit 66b11bf55ace941fdc76ae52116920008e026bdb from: Stefan Sperling date: Wed Mar 27 11:58:26 2019 UTC add a test for wt rm vs repo rm commit - fc6346c42a66d7fc562608e08dbd41e775facfc4 commit + 66b11bf55ace941fdc76ae52116920008e026bdb blob - f5e6128544c9c93da5fd836b3efe97bb428880fa blob + 76a9eeef29c6fa9d3a5d6e80c1c0e61692ecaab5 --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -1020,6 +1020,55 @@ function test_update_conflict_wt_rm_vs_repo_edit { diff -u $testroot/stdout.expected $testroot/stdout fi test_done "$testroot" "$ret" +} + +function test_update_conflict_wt_rm_vs_repo_rm { + local testroot=`test_init update_conflict_wt_rm_vs_repo_rm` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret="$?" + if [ "$ret" != "0" ]; then + test_done "$testroot" "$ret" + return 1 + fi + + (cd $testroot/repo && git rm -q beta) + git_commit $testroot/repo -m "removing a file" + + (cd $testroot/wt && got rm beta > /dev/null) + + (cd $testroot/wt && got update > $testroot/stdout) + + echo "D beta" > $testroot/stdout.expected + echo -n "Updated to commit " >> $testroot/stdout.expected + git_show_head $testroot/repo >> $testroot/stdout.expected + echo >> $testroot/stdout.expected + cmp $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + # beta is now gone... we don't flag tree conflicts yet + echo 'got: bad path' > $testroot/stderr.expected + (cd $testroot/wt && got status beta 2> $testroot/stderr) + cmp $testroot/stderr.expected $testroot/stderr + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stderr.expected $testroot/stderr + test_done "$testroot" "$ret" + return 1 + fi + + if [ -e $testroot/wt/beta ]; then + echo "removed file beta still exists on disk" >&2 + test_done "$testroot" "1" + return 1 + fi + + test_done "$testroot" "0" } run_test test_update_basic @@ -1042,3 +1091,4 @@ run_test test_update_restores_missing_file run_test test_update_conflict_wt_add_vs_repo_add run_test test_update_conflict_wt_edit_vs_repo_rm run_test test_update_conflict_wt_rm_vs_repo_edit +run_test test_update_conflict_wt_rm_vs_repo_rm