Skip to content

Commit

Permalink
commit_packed_refs(): reimplement using fdopen_lock_file()
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 1, 2014
1 parent f70f056 commit 6e578a3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2309,16 +2309,13 @@ int commit_packed_refs(void)
if (!packed_ref_cache->lock)
die("internal error: packed-refs not locked");

out = fdopen(packed_ref_cache->lock->fd, "w");
out = fdopen_lock_file(packed_ref_cache->lock, "w");
if (!out)
die_errno("unable to fdopen packed-refs descriptor");

fprintf_or_die(out, "%s", PACKED_REFS_HEADER);
do_for_each_entry_in_dir(get_packed_ref_dir(packed_ref_cache),
0, write_packed_entry_fn, out);
if (fclose(out))
die_errno("write error");
packed_ref_cache->lock->fd = -1;

if (commit_lock_file(packed_ref_cache->lock)) {
save_errno = errno;
Expand Down

0 comments on commit 6e578a3

Please sign in to comment.