Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
refs: use same lock_file object for both ref-packing functions
author
Michael Haggerty
<mhagger@alum.mit.edu>
Mon, 22 Apr 2013 19:52:34 +0000
(21:52 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 1 May 2013 22:33:11 +0000
(15:33 -0700)
Use a single struct lock_file for both pack_refs() and
repack_without_ref().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3b4ae6d
)
diff --git
a/refs.c
b/refs.c
index b536af4cb04527ee456b495b0fa16431b0a6608c..9b392bd96dfe6e8cdee89ff06e1167b68b2ceca4 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-2092,7
+2092,7
@@
static void prune_refs(struct ref_to_prune *r)
}
}
}
}
-static struct lock_file pack
ed
;
+static struct lock_file pack
lock
;
int pack_refs(unsigned int flags)
{
int pack_refs(unsigned int flags)
{
@@
-2102,7
+2102,7
@@
int pack_refs(unsigned int flags)
memset(&cbdata, 0, sizeof(cbdata));
cbdata.flags = flags;
memset(&cbdata, 0, sizeof(cbdata));
cbdata.flags = flags;
- fd = hold_lock_file_for_update(&pack
ed
, git_path("packed-refs"),
+ fd = hold_lock_file_for_update(&pack
lock
, git_path("packed-refs"),
LOCK_DIE_ON_ERROR);
cbdata.refs_file = fdopen(fd, "w");
if (!cbdata.refs_file)
LOCK_DIE_ON_ERROR);
cbdata.refs_file = fdopen(fd, "w");
if (!cbdata.refs_file)
@@
-2121,8
+2121,8
@@
int pack_refs(unsigned int flags)
* assign -1 to the lock file descriptor so that commit_lock_file()
* won't try to close() it.
*/
* assign -1 to the lock file descriptor so that commit_lock_file()
* won't try to close() it.
*/
- pack
ed
.fd = -1;
- if (commit_lock_file(&pack
ed
) < 0)
+ pack
lock
.fd = -1;
+ if (commit_lock_file(&pack
lock
) < 0)
die_errno("unable to overwrite old ref-pack file");
prune_refs(cbdata.ref_to_prune);
return 0;
die_errno("unable to overwrite old ref-pack file");
prune_refs(cbdata.ref_to_prune);
return 0;
@@
-2176,8
+2176,6
@@
static int repack_ref_fn(struct ref_entry *entry, void *cb_data)
return 0;
}
return 0;
}
-static struct lock_file packlock;
-
static int repack_without_ref(const char *refname)
{
int fd;
static int repack_without_ref(const char *refname)
{
int fd;