]> git.ipfire.org Git - thirdparty/git.git/blobdiff - object-name.c
Merge branch 'ab/ambiguous-object-name'
[thirdparty/git.git] / object-name.c
index 61b58a2f2927a34210d74f9c29a0dfe867401695..0230a87416666cc96575002236a6be1f172beb8a 100644 (file)
@@ -1892,13 +1892,13 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
        const char *cp;
        int only_to_die = flags & GET_OID_ONLY_TO_DIE;
 
-       if (only_to_die)
-               flags |= GET_OID_QUIETLY;
-
        memset(oc, 0, sizeof(*oc));
        oc->mode = S_IFINVALID;
        strbuf_init(&oc->symlink_path, 0);
        ret = get_oid_1(repo, name, namelen, oid, flags);
+       if (!ret && flags & GET_OID_REQUIRE_PATH)
+               die(_("<object>:<path> required, only <object> '%s' given"),
+                   name);
        if (!ret)
                return ret;
        /*
@@ -2029,7 +2029,7 @@ void maybe_die_on_misspelt_object_name(struct repository *r,
 {
        struct object_context oc;
        struct object_id oid;
-       get_oid_with_context_1(r, name, GET_OID_ONLY_TO_DIE,
+       get_oid_with_context_1(r, name, GET_OID_ONLY_TO_DIE | GET_OID_QUIETLY,
                               prefix, &oid, &oc);
 }