sha1-name.c: remove the_repo from other 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 65e5046400fd07e32749ff20557e11a0fc65cc67
2 files changed +32 -21
cache.h
+12 -6
@@ -1381,12 +1381,11 @@ enum get_oid_result {
1381 };
1382
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);
1388 -extern int get_oid_treeish(const char *str, struct object_id *oid);
1389 -extern int get_oid_blob(const char *str, struct object_id *oid);
1384 +int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
1385 +int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
1386 +int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
1387 +int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
1388 +int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
1389 void maybe_die_on_misspelt_object_name(struct repository *repo,
1390 const char *name,
1391 const char *prefix);
@@ -1394,6 +1393,13 @@ extern enum get_oid_result get_oid_with_context(struct repository *repo, const c
1393 unsigned flags, struct object_id *oid,
1394 struct object_context *oc);
1395
1396 +#define get_oid(str, oid) repo_get_oid(the_repository, str, oid)
1397 +#define get_oid_commit(str, oid) repo_get_oid_commit(the_repository, str, oid)
1398 +#define get_oid_committish(str, oid) repo_get_oid_committish(the_repository, str, oid)
1399 +#define get_oid_tree(str, oid) repo_get_oid_tree(the_repository, str, oid)
1400 +#define get_oid_treeish(str, oid) repo_get_oid_treeish(the_repository, str, oid)
1401 +#define get_oid_blob(str, oid) repo_get_oid_blob(the_repository, str, oid)
1402 +
1403 typedef int each_abbrev_fn(const struct object_id *oid, void *);
1404 int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
1405 #define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)
sha1-name.c
+20 -15
@@ -1590,43 +1590,48 @@ int repo_get_oid(struct repository *r, const char *name, struct object_id *oid)
1590 * commit-ish. It is merely to give a hint to the disambiguation
1591 * machinery.
1592 */
1593 -int get_oid_committish(const char *name, struct object_id *oid)
1593 +int repo_get_oid_committish(struct repository *r,
1594 + const char *name,
1595 + struct object_id *oid)
1596 {
1597 struct object_context unused;
1596 - return get_oid_with_context(the_repository,
1597 - name, GET_OID_COMMITTISH,
1598 + return get_oid_with_context(r, name, GET_OID_COMMITTISH,
1599 oid, &unused);
1600 }
1601
1601 -int get_oid_treeish(const char *name, struct object_id *oid)
1602 +int repo_get_oid_treeish(struct repository *r,
1603 + const char *name,
1604 + struct object_id *oid)
1605 {
1606 struct object_context unused;
1604 - return get_oid_with_context(the_repository,
1605 - name, GET_OID_TREEISH,
1607 + return get_oid_with_context(r, name, GET_OID_TREEISH,
1608 oid, &unused);
1609 }
1610
1609 -int get_oid_commit(const char *name, struct object_id *oid)
1611 +int repo_get_oid_commit(struct repository *r,
1612 + const char *name,
1613 + struct object_id *oid)
1614 {
1615 struct object_context unused;
1612 - return get_oid_with_context(the_repository,
1613 - name, GET_OID_COMMIT,
1616 + return get_oid_with_context(r, name, GET_OID_COMMIT,
1617 oid, &unused);
1618 }
1619
1617 -int get_oid_tree(const char *name, struct object_id *oid)
1620 +int repo_get_oid_tree(struct repository *r,
1621 + const char *name,
1622 + struct object_id *oid)
1623 {
1624 struct object_context unused;
1620 - return get_oid_with_context(the_repository,
1621 - name, GET_OID_TREE,
1625 + return get_oid_with_context(r, name, GET_OID_TREE,
1626 oid, &unused);
1627 }
1628
1625 -int get_oid_blob(const char *name, struct object_id *oid)
1629 +int repo_get_oid_blob(struct repository *r,
1630 + const char *name,
1631 + struct object_id *oid)
1632 {
1633 struct object_context unused;
1628 - return get_oid_with_context(the_repository,
1629 - name, GET_OID_BLOB,
1634 + return get_oid_with_context(r, name, GET_OID_BLOB,
1635 oid, &unused);
1636 }
1637