diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-30 15:40:01 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-30 15:40:05 -0700 |
commit | 079424a2cffa9c5a96c958ec50bb5a865a9305cf (patch) | |
tree | 09bd5381af78c8e2d1d86690c7568e2cf7279d93 /builtin/clone.c | |
parent | 08585fd48d2d3d8facce9bdc366cfd896329a4b8 (diff) | |
parent | 98eeb09e8acb6cbe0b0da3b1772b6676fe6d167f (diff) | |
download | git-079424a2cffa9c5a96c958ec50bb5a865a9305cf.tar.gz git-079424a2cffa9c5a96c958ec50bb5a865a9305cf.tar.xz |
Merge branch 'mh/ref-races'
"git pack-refs" that races with new ref creation or deletion have
been susceptible to lossage of refs under right conditions, which
has been tightened up.
* mh/ref-races:
for_each_ref: load all loose refs before packed refs
get_packed_ref_cache: reload packed-refs file when it changes
add a stat_validity struct
Extract a struct stat_data from cache_entry
packed_ref_cache: increment refcount when locked
do_for_each_entry(): increment the packed refs cache refcount
refs: manage lifetime of packed refs cache via reference counting
refs: implement simple transactions for the packed-refs file
refs: wrap the packed refs cache in a level of indirection
pack_refs(): split creation of packed refs and entry writing
repack_without_ref(): split list curation and entry writing
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 66bff5700..14b132356 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -493,13 +493,16 @@ static void write_remote_refs(const struct ref *local_refs) { const struct ref *r; + lock_packed_refs(LOCK_DIE_ON_ERROR); + for (r = local_refs; r; r = r->next) { if (!r->peer_ref) continue; add_packed_ref(r->peer_ref->name, r->old_sha1); } - pack_refs(PACK_REFS_ALL); + if (commit_packed_refs()) + die_errno("unable to overwrite old ref-pack file"); } static void write_followtags(const struct ref *refs, const char *msg) |