summaryrefslogtreecommitdiff
path: root/sha1-name.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1-name.c')
-rw-r--r--sha1-name.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sha1-name.c b/sha1-name.c
index cfe5c874b6..07c71a7567 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -1530,6 +1530,25 @@ int get_oid(const char *name, struct object_id *oid)
return get_oid_with_context(the_repository, name, 0, oid, &unused);
}
+/*
+ * This returns a non-zero value if the string (built using printf
+ * format and the given arguments) is not a valid object.
+ */
+int get_oidf(struct object_id *oid, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+ struct strbuf sb = STRBUF_INIT;
+
+ va_start(ap, fmt);
+ strbuf_vaddf(&sb, fmt, ap);
+ va_end(ap);
+
+ ret = get_oid(sb.buf, oid);
+ strbuf_release(&sb);
+
+ return ret;
+}
/*
* Many callers know that the user meant to name a commit-ish by