summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2019-10-15 00:12:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-16 02:07:51 (GMT)
commit5374a290aa56390f9f44547d52f8f30fb2e866aa (patch)
tree046ddf404e5b98365119a7fd12d3cb34a5a35919 /builtin/repack.c
parent08da6496b61341ec45eac36afcc8f94242763468 (diff)
downloadgit-5374a290aa56390f9f44547d52f8f30fb2e866aa.zip
git-5374a290aa56390f9f44547d52f8f30fb2e866aa.tar.gz
git-5374a290aa56390f9f44547d52f8f30fb2e866aa.tar.bz2
fetch-pack: write fetched refs to .promisor
The specification of promisor packfiles (in partial-clone.txt) states that the .promisor files that accompany packfiles do not matter (just like .keep files), so whenever a packfile is fetched from the promisor remote, Git has been writing empty .promisor files. But these files could contain more useful information. So instead of writing empty files, write the refs fetched to these files. This makes it easier to debug issues with partial clones, as we can identify what refs (and their associated hashes) were fetched at the time the packfile was downloaded, and if necessary, compare those hashes against what the promisor remote reports now. This is implemented by teaching fetch-pack to write its own non-empty .promisor file whenever it knows the name of the pack's lockfile. This covers the case wherein the user runs "git fetch" with an internal protocol or HTTP protocol v2 (fetch_refs_via_pack() in transport.c sets lock_pack) and with HTTP protocol v0/v1 (fetch_git() in remote-curl.c passes "--lock-pack" to "fetch-pack"). Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Acked-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 094c2f8..78b23d7 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -233,6 +233,13 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
/*
* pack-objects creates the .pack and .idx files, but not the
* .promisor file. Create the .promisor file, which is empty.
+ *
+ * NEEDSWORK: fetch-pack sometimes generates non-empty
+ * .promisor files containing the ref names and associated
+ * hashes at the point of generation of the corresponding
+ * packfile, but this would not preserve their contents. Maybe
+ * concatenate the contents of all .promisor files instead of
+ * just creating a new empty file.
*/
promisor_name = mkpathdup("%s-%s.promisor", packtmp,
line.buf);