sha1-name.c: add repo_get_oid()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Apr 16, 2019 at 16:33 UTC ec580eaaa3bdc2327d049932d1ebb2ca62aae837
2 files changed +4 -3
cache.h
+2 -1
@@ -1380,7 +1380,8 @@ enum get_oid_result {
1380 */
1381 };
1382
1383 -extern int get_oid(const char *str, struct object_id *oid);
1383 +int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
1384 +#define get_oid(str, oid) repo_get_oid(the_repository, str, oid)
1385 extern int get_oid_commit(const char *str, struct object_id *oid);
1386 extern int get_oid_committish(const char *str, struct object_id *oid);
1387 extern int get_oid_tree(const char *str, struct object_id *oid);
sha1-name.c
+2 -2
@@ -1573,10 +1573,10 @@ int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
1573 * This is like "get_oid_basic()", except it allows "object ID expressions",
1574 * notably "xyz^" for "parent of xyz"
1575 */
1576 -int get_oid(const char *name, struct object_id *oid)
1576 +int repo_get_oid(struct repository *r, const char *name, struct object_id *oid)
1577 {
1578 struct object_context unused;
1579 - return get_oid_with_context(the_repository, name, 0, oid, &unused);
1579 + return get_oid_with_context(r, name, 0, oid, &unused);
1580 }
1581
1582