From 1788c39cd0742439b9bedc28bc10bc4d105b6c0f Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 14 Sep 2007 03:31:23 -0400 Subject: Remove pack.keep after ref updates in git-fetch If we are using a native packfile to perform a git-fetch invocation and the received packfile contained more than the configured limits of fetch.unpackLimit/transfer.unpackLimit then index-pack will output a single line saying "keep\t$sha1\n" to stdout. This line needs to be captured and retained so we can delete the corresponding .keep file ("$GIT_DIR/objects/pack/pack-$sha1.keep") once all refs have been safely updated. This trick has long been in use with git-fetch.sh and its lower level helper git-fetch--tool as a way to allow index-pack to save the new packfile before the refs have been updated and yet avoid a race with any concurrently running git-repack process. It was unfortunately lost when git-fetch.sh was converted to pure C and fetch--tool was no longer being invoked. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- transport.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'transport.h') diff --git a/transport.h b/transport.h index b354a8fd18..f2bbdf778a 100644 --- a/transport.h +++ b/transport.h @@ -15,6 +15,7 @@ struct transport { struct ref *remote_refs; const struct transport_ops *ops; + char *pack_lockfile; }; #define TRANSPORT_PUSH_ALL 1 @@ -30,7 +31,7 @@ struct transport_ops { const char *value); struct ref *(*get_refs_list)(const struct transport *transport); - int (*fetch)(const struct transport *transport, int refs_nr, struct ref **refs); + int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs); int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags); int (*disconnect)(struct transport *connection); @@ -73,7 +74,7 @@ int transport_push(struct transport *connection, struct ref *transport_get_remote_refs(struct transport *transport); int transport_fetch_refs(struct transport *transport, struct ref *refs); - +void transport_unlock_pack(struct transport *transport); int transport_disconnect(struct transport *transport); #endif -- cgit v1.2.1