resolve_missing_loose_ref(): add a files_ref_store argument
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Sep 4, 2016 at 18:08 UTC
4308651c3cbef316d070e3dbbbf5e53d56a56548
1 file changed
+6
-6
refs/files-backend.c
+6
-6
@@ -1412,13 +1412,11 @@ static struct ref_entry *get_packed_ref(struct files_ref_store *refs,
1412
/*
1413
* A loose ref file doesn't exist; check for a packed ref.
1414
*/
1415
-static int resolve_missing_loose_ref(const char *refname,
1415
+static int resolve_missing_loose_ref(struct files_ref_store *refs,
1416
+ const char *refname,
1417
unsigned char *sha1,
1418
unsigned int *flags)
1419
{
1419
- struct files_ref_store *refs =
1420
- get_files_ref_store(NULL, "resolve_missing_loose_ref");
1421
-
1420
struct ref_entry *entry;
1421
1422
/*
@@ -1438,6 +1436,8 @@ static int resolve_missing_loose_ref(const char *refname,
1436
int read_raw_ref(const char *refname, unsigned char *sha1,
1437
struct strbuf *referent, unsigned int *type)
1438
{
1439
+ struct files_ref_store *refs =
1440
+ get_files_ref_store(NULL, "read_raw_ref");
1441
struct strbuf sb_contents = STRBUF_INIT;
1442
struct strbuf sb_path = STRBUF_INIT;
1443
const char *path;
@@ -1466,7 +1466,7 @@ stat_ref:
1466
if (lstat(path, &st) < 0) {
1467
if (errno != ENOENT)
1468
goto out;
1469
- if (resolve_missing_loose_ref(refname, sha1, type)) {
1469
+ if (resolve_missing_loose_ref(refs, refname, sha1, type)) {
1470
errno = ENOENT;
1471
goto out;
1472
}
@@ -1500,7 +1500,7 @@ stat_ref:
1500
* ref is supposed to be, there could still be a
1501
* packed ref:
1502
*/
1503
- if (resolve_missing_loose_ref(refname, sha1, type)) {
1503
+ if (resolve_missing_loose_ref(refs, refname, sha1, type)) {
1504
errno = EISDIR;
1505
goto out;
1506
}