commit - 961964db5e0e6f4f1568b633d83807af65c922d5
commit + ddbb3188dfcc3d488f561df80ff17b4783b00dd1
blob - 615f66fabdd166d9721ab090fe1c364e1769bfbd
blob + eab399777a9e609d5c47a051ccb6670648eb8fb3
--- lib/object.c
+++ lib/object.c
return err;
*fd = open(path, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
if (*fd == -1) {
- err = got_error_from_errno2("open", path);
+ if (errno == ENOENT)
+ err = got_error_no_obj(id);
+ else
+ err = got_error_from_errno2("open", path);
goto done;
}
done:
blob - d6225e5adf9ab9758646a0e40580dc931306c7f4
blob + ea32f22e2f55de21f40313b7d5bfd7250fb8b166
--- lib/object_open_io.c
+++ lib/object_open_io.c
return NULL;
err = got_object_open_loose_fd(&fd, id, repo);
- if (err) {
- if (err->code == GOT_ERR_ERRNO && errno == ENOENT)
- err = got_error_no_obj(id);
+ if (err)
return err;
- }
err = got_object_read_header(obj, fd);
if (err)
blob - c156857f4cc554d6633d9059a6c60e29c68bfdbd
blob + 2bb64eceaff2476797ea46cd6e94349d6d17ae7e
--- lib/object_open_privsep.c
+++ lib/object_open_privsep.c
}
err = got_object_open_loose_fd(&fd, id, repo);
- if (err) {
- if (err->code == GOT_ERR_ERRNO && errno == ENOENT)
- err = got_error_no_obj(id);
+ if (err)
return err;
- }
err = got_object_read_header_privsep(obj, id, repo, fd);
if (err)
blob - 1b2025992be4d03420f106db1af5777b5bb84907
blob + 6f82982ad2e1d53c37ba2de0a2ebfaca01a77193
--- regress/cmdline/tree.sh
+++ regress/cmdline/tree.sh
local submodule_id=$(got tree -r $testroot/repo -i | \
grep 'repo2\$$' | cut -d ' ' -f1)
- local objpath=`get_loose_object_path $testroot/repo $submodule_id`
- # Currently fails in open(2)
got tree -r $testroot/repo repo2 > $testroot/stdout 2> $testroot/stderr
ret=$?
if [ $ret -eq 0 ]; then
test_done "$testroot" "1"
return 1
fi
- echo "got: open: $objpath: No such file or directory" \
- > $testroot/stderr.expected
+ echo "got: object $submodule_id not found" > $testroot/stderr.expected
cmp -s $testroot/stderr.expected $testroot/stderr
ret=$?