commit 138e4f4798d5a09e2b97c9a18e49999fb8ff599b from: Stefan Sperling date: Sat Oct 09 19:47:15 2021 UTC display the requested object type when an object could not be found ok millert@ commit - 8f83a2643c211f21ec5731e80ebcb6218f7c6689 commit + 138e4f4798d5a09e2b97c9a18e49999fb8ff599b blob - b06c9dd2e1937dcf6624689b565d28b3a51d1c4a blob + 17697cc62656dd554d17df6ee00a548fde19f6e9 --- lib/repository.c +++ 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, } 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; } blob - f4f0029ca41073b2b76c6a560ab229e160f04d55 blob + fb11f286780b130bb30e7694ace57e52e5548050 --- regress/cmdline/log.sh +++ 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 blob - fdc7ff875ee50b4012f757c1df86b00c41cd3dd0 blob + 6e76b311f1077b2317955711690448d4be3efebc --- regress/cmdline/tag.sh +++ 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