summaryrefslogtreecommitdiff
path: root/fetch-negotiator.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-07-16 18:44:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 21:51:12 (GMT)
commit42cc7485a2ec49ecc440c921d2eb0cae4da80549 (patch)
tree576a4ddf4327faf750dd9017fb2cf70c21ae8bda /fetch-negotiator.c
parentec06283844a90c3e9440286401e9ad7d86daa5ae (diff)
downloadgit-42cc7485a2ec49ecc440c921d2eb0cae4da80549.zip
git-42cc7485a2ec49ecc440c921d2eb0cae4da80549.tar.gz
git-42cc7485a2ec49ecc440c921d2eb0cae4da80549.tar.bz2
negotiator/skipping: skip commits during fetch
Introduce a new negotiation algorithm used during fetch that skips commits in an effort to find common ancestors faster. The skips grow similarly to the Fibonacci sequence as the commit walk proceeds further away from the tips. The skips may cause unnecessary commits to be included in the packfile, but the negotiation step typically ends more quickly. Usage of this algorithm is guarded behind the configuration flag fetch.negotiationAlgorithm. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fetch-negotiator.c')
-rw-r--r--fetch-negotiator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fetch-negotiator.c b/fetch-negotiator.c
index 2675d12..5d28304 100644
--- a/fetch-negotiator.c
+++ b/fetch-negotiator.c
@@ -1,8 +1,14 @@
#include "git-compat-util.h"
#include "fetch-negotiator.h"
#include "negotiator/default.h"
+#include "negotiator/skipping.h"
-void fetch_negotiator_init(struct fetch_negotiator *negotiator)
+void fetch_negotiator_init(struct fetch_negotiator *negotiator,
+ const char *algorithm)
{
+ if (algorithm && !strcmp(algorithm, "skipping")) {
+ skipping_negotiator_init(negotiator);
+ return;
+ }
default_negotiator_init(negotiator);
}