display the requested object type when an object could not be found ok millert@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/lib/repository.c b/lib/repository.c
index b06c9dd..17697cc 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1485,8 +1485,29 @@ done:
if (err) {
free(*id);
*id = NULL;
- } else if (*id == NULL)
- err = got_error_path(id_str_prefix, GOT_ERR_NO_OBJ);
+ } else if (*id == NULL) {
+ switch (obj_type) {
+ case GOT_OBJ_TYPE_BLOB:
+ err = got_error_fmt(GOT_ERR_NO_OBJ, "%s %s",
+ GOT_OBJ_LABEL_BLOB, id_str_prefix);
+ break;
+ case GOT_OBJ_TYPE_TREE:
+ err = got_error_fmt(GOT_ERR_NO_OBJ, "%s %s",
+ GOT_OBJ_LABEL_TREE, id_str_prefix);
+ break;
+ case GOT_OBJ_TYPE_COMMIT:
+ err = got_error_fmt(GOT_ERR_NO_OBJ, "%s %s",
+ GOT_OBJ_LABEL_COMMIT, id_str_prefix);
+ break;
+ case GOT_OBJ_TYPE_TAG:
+ err = got_error_fmt(GOT_ERR_NO_OBJ, "%s %s",
+ GOT_OBJ_LABEL_TAG, id_str_prefix);
+ break;
+ default:
+ err = got_error_path(id_str_prefix, GOT_ERR_NO_OBJ);
+ break;
+ }
+ }
return err;
}
@@ -1590,7 +1611,8 @@ got_repo_object_match_tag(struct got_tag_object **tag, const char *name,
}
if (err == NULL && *tag == NULL)
- err = got_error_path(name, GOT_ERR_NO_OBJ);
+ err = got_error_fmt(GOT_ERR_NO_OBJ, "%s %s",
+ GOT_OBJ_LABEL_TAG, name);
return err;
}
diff --git a/regress/cmdline/log.sh b/regress/cmdline/log.sh
index f4f0029..fb11f28 100755
--- a/regress/cmdline/log.sh
+++ b/regress/cmdline/log.sh
@@ -500,7 +500,8 @@ test_log_end_at_commit() {
return 1
fi
echo -n > $testroot/stdout.expected
- echo "got: $empty_sha1: object not found" > $testroot/stderr.expected
+ echo "got: commit $empty_sha1: object not found" \
+ > $testroot/stderr.expected
cmp -s $testroot/stderr.expected $testroot/stderr
ret="$?"
if [ "$ret" != "0" ]; then
diff --git a/regress/cmdline/tag.sh b/regress/cmdline/tag.sh
index fdc7ff8..6e76b31 100755
--- a/regress/cmdline/tag.sh
+++ b/regress/cmdline/tag.sh
@@ -98,7 +98,8 @@ test_tag_create() {
return 1
fi
- echo "got: $tree_id: object not found" > $testroot/stderr.expected
+ echo "got: commit $tree_id: object not found" \
+ > $testroot/stderr.expected
cmp -s $testroot/stderr $testroot/stderr.expected
ret="$?"
if [ "$ret" != "0" ]; then