commit_packed_refs(): take a `packed_ref_store *` parameter

It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Jun 23, 2017 at 09:01 UTC cf30b3e88b0551f67ff4e0b8c35aedf6b03c41d7
1 file changed +9 -9
refs/files-backend.c
+9 -9
@@ -1388,21 +1388,21 @@ static int lock_packed_refs(struct packed_ref_store *refs, int flags)
1388 * lock_packed_refs()). Return zero on success. On errors, set errno
1389 * and return a nonzero value
1390 */
1391 -static int commit_packed_refs(struct files_ref_store *refs)
1391 +static int commit_packed_refs(struct packed_ref_store *refs)
1392 {
1393 struct packed_ref_cache *packed_ref_cache =
1394 - get_packed_ref_cache(refs->packed_ref_store);
1394 + get_packed_ref_cache(refs);
1395 int ok, error = 0;
1396 int save_errno = 0;
1397 FILE *out;
1398 struct ref_iterator *iter;
1399
1400 - files_assert_main_repository(refs, "commit_packed_refs");
1400 + packed_assert_main_repository(refs, "commit_packed_refs");
1401
1402 - if (!is_lock_file_locked(&refs->packed_ref_store->lock))
1402 + if (!is_lock_file_locked(&refs->lock))
1403 die("BUG: packed-refs not locked");
1404
1405 - out = fdopen_lock_file(&refs->packed_ref_store->lock, "w");
1405 + out = fdopen_lock_file(&refs->lock, "w");
1406 if (!out)
1407 die_errno("unable to fdopen packed-refs descriptor");
1408
@@ -1420,7 +1420,7 @@ static int commit_packed_refs(struct files_ref_store *refs)
1420 if (ok != ITER_DONE)
1421 die("error while iterating over references");
1422
1423 - if (commit_lock_file(&refs->packed_ref_store->lock)) {
1423 + if (commit_lock_file(&refs->lock)) {
1424 save_errno = errno;
1425 error = -1;
1426 }
@@ -1606,7 +1606,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
1606 if (ok != ITER_DONE)
1607 die("error while iterating over references");
1608
1609 - if (commit_packed_refs(refs))
1609 + if (commit_packed_refs(refs->packed_ref_store))
1610 die_errno("unable to overwrite old ref-pack file");
1611
1612 prune_refs(refs, refs_to_prune);
@@ -1662,7 +1662,7 @@ static int repack_without_refs(struct files_ref_store *refs,
1662 }
1663
1664 /* Write what remains */
1665 - ret = commit_packed_refs(refs);
1665 + ret = commit_packed_refs(refs->packed_ref_store);
1666 if (ret)
1667 strbuf_addf(err, "unable to overwrite old ref-pack file: %s",
1668 strerror(errno));
@@ -3227,7 +3227,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
3227 &update->new_oid);
3228 }
3229
3230 - if (commit_packed_refs(refs)) {
3230 + if (commit_packed_refs(refs->packed_ref_store)) {
3231 strbuf_addf(err, "unable to commit packed-refs file: %s",
3232 strerror(errno));
3233 ret = TRANSACTION_GENERIC_ERROR;