commit - ac8217d34e24bbe491283bcbb33dc63fac02cfa8
commit + c6119c6d1145977d2ae8fb6754a9c369731d8dec
blob - d853c6a2eec0e5067f684d2bdf43979a898c26bb
blob + 9f5251a990cf46f44d7ad7659d1b24da2364c587
--- got/got.c
+++ got/got.c
err = got_error_msg(GOT_ERR_NOT_WORKTREE, msg);
if (repo) {
const struct got_error *close_err = got_repo_close(repo);
- if (close_err == NULL)
+ if (err == NULL)
err = close_err;
}
if (pack_fds) {
blob - 282f6198ef06d3c01364dc6a50d274ad0a31821e
blob + 28da1dacd8934b690da5ceef71b0f51b9bcb8c87
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
ret=$?
if [ $ret -ne 0 ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ fi
+ test_done "$testroot" "$ret"
+}
+
+test_status_in_repo() {
+ local testroot=`test_init status_in_repo`
+
+ (cd $testroot/repo && got status > $testroot/stdout \
+ 2> $testroot/stderr)
+
+ cat > $testroot/stderr.expected <<EOF
+got: 'got status' needs a work tree in addition to a git repository
+Work trees can be checked out from this Git repository with 'got checkout'.
+The got(1) manual page contains more information.
+EOF
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
fi
test_done "$testroot" "$ret"
}
run_test test_status_status_code
run_test test_status_suppress
run_test test_status_empty_file
+run_test test_status_in_repo