commit_packed_refs(): remove call to `packed_refs_unlock()`

Instead, change the callers of `commit_packed_refs()` to call
`packed_refs_unlock()`.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Michael Haggerty 2017-06-23 09:01:45 +02:00 committed by Junio C Hamano
parent 9051198214
commit 42c7f7ff96
2 changed files with 10 additions and 10 deletions

View File

@ -1131,6 +1131,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)


if (commit_packed_refs(refs->packed_ref_store, &err)) if (commit_packed_refs(refs->packed_ref_store, &err))
die("unable to overwrite old ref-pack file: %s", err.buf); die("unable to overwrite old ref-pack file: %s", err.buf);
packed_refs_unlock(refs->packed_ref_store);


prune_refs(refs, refs_to_prune); prune_refs(refs, refs_to_prune);
strbuf_release(&err); strbuf_release(&err);
@ -2699,6 +2700,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
} }


cleanup: cleanup:
packed_refs_unlock(refs->packed_ref_store);
transaction->state = REF_TRANSACTION_CLOSED; transaction->state = REF_TRANSACTION_CLOSED;
string_list_clear(&affected_refnames, 0); string_list_clear(&affected_refnames, 0);
return ret; return ret;

View File

@ -606,7 +606,6 @@ int commit_packed_refs(struct ref_store *ref_store, struct strbuf *err)
struct packed_ref_cache *packed_ref_cache = struct packed_ref_cache *packed_ref_cache =
get_packed_ref_cache(refs); get_packed_ref_cache(refs);
int ok; int ok;
int ret = -1;
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
FILE *out; FILE *out;
struct ref_iterator *iter; struct ref_iterator *iter;
@ -619,7 +618,7 @@ int commit_packed_refs(struct ref_store *ref_store, struct strbuf *err)
strbuf_addf(err, "unable to create file %s: %s", strbuf_addf(err, "unable to create file %s: %s",
sb.buf, strerror(errno)); sb.buf, strerror(errno));
strbuf_release(&sb); strbuf_release(&sb);
goto out; return -1;
} }
strbuf_release(&sb); strbuf_release(&sb);


@ -660,18 +659,14 @@ int commit_packed_refs(struct ref_store *ref_store, struct strbuf *err)
if (rename_tempfile(&refs->tempfile, refs->path)) { if (rename_tempfile(&refs->tempfile, refs->path)) {
strbuf_addf(err, "error replacing %s: %s", strbuf_addf(err, "error replacing %s: %s",
refs->path, strerror(errno)); refs->path, strerror(errno));
goto out; return -1;
} }


ret = 0; return 0;
goto out;


error: error:
delete_tempfile(&refs->tempfile); delete_tempfile(&refs->tempfile);

return -1;
out:
packed_refs_unlock(ref_store);
return ret;
} }


/* /*
@ -705,6 +700,7 @@ int repack_without_refs(struct ref_store *ref_store,
struct ref_dir *packed; struct ref_dir *packed;
struct string_list_item *refname; struct string_list_item *refname;
int needs_repacking = 0, removed = 0; int needs_repacking = 0, removed = 0;
int ret;


packed_assert_main_repository(refs, "repack_without_refs"); packed_assert_main_repository(refs, "repack_without_refs");
assert(err); assert(err);
@ -740,7 +736,9 @@ int repack_without_refs(struct ref_store *ref_store,
} }


/* Write what remains */ /* Write what remains */
return commit_packed_refs(&refs->base, err); ret = commit_packed_refs(&refs->base, err);
packed_refs_unlock(ref_store);
return ret;
} }


static int packed_init_db(struct ref_store *ref_store, struct strbuf *err) static int packed_init_db(struct ref_store *ref_store, struct strbuf *err)