Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'object-name.c')
-rw-r--r--object-name.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/object-name.c b/object-name.c
index fdff4601b2..9750634ee7 100644
--- a/object-name.c
+++ b/object-name.c
@@ -361,6 +361,16 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
return 0;
type = oid_object_info(ds->repo, oid, NULL);
+
+ if (type < 0) {
+ strbuf_addstr(&desc, "[bad object]");
+ goto out;
+ }
+
+ assert(type == OBJ_TREE || type == OBJ_COMMIT ||
+ type == OBJ_BLOB || type == OBJ_TAG);
+ strbuf_addstr(&desc, type_name(type));
+
if (type == OBJ_COMMIT) {
struct commit *commit = lookup_commit(ds->repo, oid);
if (commit) {
@@ -374,9 +384,9 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
strbuf_addf(&desc, " %s", tag->tag);
}
- advise(" %s %s%s",
+out:
+ advise(" %s %s",
repo_find_unique_abbrev(ds->repo, oid, DEFAULT_ABBREV),
- type_name(type) ? type_name(type) : "unknown type",
desc.buf);
strbuf_release(&desc);