commit - 57ba6a8b2290654163b428404a7fd1fe0ae808a1
commit + 8564cb2124254043a0038930300e9e9987914443
blob - ee91795f5118fb2597cd411245f9a16513e8d572
blob + c2672408cd683b49b4e89f1d3717c948e64f6e6d
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
diff -u $testroot/stderr.expected $testroot/stderr
fi
test_done "$testroot" "$ret"
+
+}
+
+function test_stage_nonexistent {
+ local testroot=`test_init stage_nonexistent`
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+ (cd $testroot/wt && got stage nonexistent-file \
+ > $testroot/stdout 2> $testroot/stderr)
+ echo "got: no changes to stage" > $testroot/stderr.expected
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
+ fi
+ test_done "$testroot" "$ret"
}
function test_stage_list {
run_test test_stage_basic
run_test test_stage_no_changes
run_test test_stage_unversioned
+run_test test_stage_nonexistent
run_test test_stage_list
run_test test_stage_conflict
run_test test_stage_out_of_date
blob - 6c72ab7bd35892d5e669cf16068e0f55bb9e5a74
blob + ef2a91d696b6b381bc506f6ed946a1bfa9412d17
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
test_done "$testroot" "$ret"
}
+function test_unstage_nonexistent {
+ local testroot=`test_init unstage_nonexistent`
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "modified file" > $testroot/wt/alpha
+ (cd $testroot/wt && got rm beta > /dev/null)
+ echo "new file" > $testroot/wt/foo
+ (cd $testroot/wt && got add foo > /dev/null)
+
+ echo ' M alpha' > $testroot/stdout.expected
+ echo ' D beta' >> $testroot/stdout.expected
+ echo ' A foo' >> $testroot/stdout.expected
+ (cd $testroot/wt && got stage > /dev/null)
+
+ # unstaging a non-existent file is a no-op
+ (cd $testroot/wt && got unstage nonexistent-file > $testroot/stdout)
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ echo "got unstage command failed unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ echo -n > $testroot/stdout.expected
+ 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_unstage_patch {
local testroot=`test_init unstage_patch`
run_test test_unstage_basic
run_test test_unstage_unversioned
+run_test test_unstage_nonexistent
run_test test_unstage_patch
run_test test_unstage_patch_added
run_test test_unstage_patch_removed