summaryrefslogtreecommitdiff
path: root/fetch-pack.h
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-05-04 21:16:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-05 01:41:29 (GMT)
commit9c1e657a8fd26fa3ed8d13fb8c796cef8db8b124 (patch)
tree79ed7a1763a89a1be268af86dda6110a2d0c2a1a /fetch-pack.h
parent6871d0cec62dc12d0c5f7390eee8a80614919578 (diff)
downloadgit-9c1e657a8fd26fa3ed8d13fb8c796cef8db8b124.zip
git-9c1e657a8fd26fa3ed8d13fb8c796cef8db8b124.tar.gz
git-9c1e657a8fd26fa3ed8d13fb8c796cef8db8b124.tar.bz2
fetch: teach independent negotiation (no packfile)
Currently, the packfile negotiation step within a Git fetch cannot be done independent of sending the packfile, even though there is at least one application wherein this is useful. Therefore, make it possible for this negotiation step to be done independently. A subsequent commit will use this for one such application - push negotiation. This feature is for protocol v2 only. (An implementation for protocol v0 would require a separate implementation in the fetch, transport, and transport helper code.) In the protocol, the main hindrance towards independent negotiation is that the server can unilaterally decide to send the packfile. This is solved by a "wait-for-done" argument: the server will then wait for the client to say "done". In practice, the client will never say it; instead it will cease requests once it is satisfied. In the client, the main change lies in the transport and transport helper code. fetch_refs_via_pack() performs everything needed - protocol version and capability checks, and the negotiation itself. There are 2 code paths that do not go through fetch_refs_via_pack() that needed to be individually excluded: the bundle transport (excluded through requiring smart_options, which the bundle transport doesn't support) and transport helpers that do not support takeover. If or when we support independent negotiation for protocol v0, we will need to modify these 2 code paths to support it. But for now, report failure if independent negotiation is requested in these cases. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fetch-pack.h')
-rw-r--r--fetch-pack.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/fetch-pack.h b/fetch-pack.h
index f114d72..7f94a2a 100644
--- a/fetch-pack.h
+++ b/fetch-pack.h
@@ -5,6 +5,7 @@
#include "run-command.h"
#include "protocol.h"
#include "list-objects-filter-options.h"
+#include "oidset.h"
struct oid_array;
@@ -82,6 +83,19 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
enum protocol_version version);
/*
+ * Execute the --negotiate-only mode of "git fetch", adding all known common
+ * commits to acked_commits.
+ *
+ * In the capability advertisement that has happened prior to invoking this
+ * function, the "wait-for-done" capability must be present.
+ */
+void negotiate_using_fetch(const struct oid_array *negotiation_tips,
+ const struct string_list *server_options,
+ int stateless_rpc,
+ int fd[],
+ struct oidset *acked_commits);
+
+/*
* Print an appropriate error message for each sought ref that wasn't
* matched. Return 0 if all sought refs were matched, otherwise 1.
*/