commit - 4e12cd97c02ae412c5a247dfaffa22ad58dd98b4
commit + 692bdcc498e440f1604cf7ba8a5cac22966c2ece
blob - 7b9584f4e628041adfb0cb7d180a875fa9e5a922
blob + 02ace087b87f181bf1e2f38cb278ab69608602f7
--- lib/worktree.c
+++ lib/worktree.c
ie = got_fileindex_entry_get(a->fileindex, relpath, strlen(relpath));
if (ie == NULL)
- return got_error_path(relpath, GOT_ERR_BAD_PATH);
+ return got_error_path(relpath, GOT_ERR_FILE_STATUS);
staged_status = get_staged_status(ie);
if (staged_status != GOT_STATUS_NO_CHANGE) {
blob - 8b4c659ae6120bad5862072ea9cc9fd55eaaaccd
blob + f82d2c0f4b893ae2e6c20f40ea0f892622559bec
--- regress/cmdline/rm.sh
+++ regress/cmdline/rm.sh
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ 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
+
+ # While here, test behaviour of rm on files in unversioned status.
+ (cd $testroot/wt && got rm epsilon/alpha > $testroot/stdout \
+ 2> $testroot/stderr)
+ ret="$?"
+ if [ "$ret" == "0" ]; then
+ echo "got rm command succeeded unexpectedly" >&2
+ diff -u $testroot/stderr.expected $testroot/stderr
+ 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
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "got: epsilon/alpha: file has unexpected status" \
+ > $testroot/stderr.expected
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
test_done "$testroot" "$ret"
return 1
fi
+ # And test the same case with -f.
+ (cd $testroot/wt && got rm -f epsilon/alpha > $testroot/stdout \
+ 2> $testroot/stderr)
+ ret="$?"
+ if [ "$ret" == "0" ]; then
+ echo "got rm command succeeded unexpectedly" >&2
+ diff -u $testroot/stderr.expected $testroot/stderr
+ 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
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "got: epsilon/alpha: file has unexpected status" \
+ > $testroot/stderr.expected
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
test_done "$testroot" "$ret"
return 1
fi