summaryrefslogtreecommitdiff
path: root/negotiator/noop.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-03 19:37:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-03 19:37:04 (GMT)
commitb4100f366c1e5adf3a254cdc6f832aa1a4461053 (patch)
tree0cd253a268b0b06a09dd3cf17e60b666d67632d5 /negotiator/noop.c
parent3f02c0ad360d96e8dbba92f97b42ebbaa4319db1 (diff)
parentdb3c293ecded67128b74a03f01e65c6799ff1116 (diff)
downloadgit-b4100f366c1e5adf3a254cdc6f832aa1a4461053.zip
git-b4100f366c1e5adf3a254cdc6f832aa1a4461053.tar.gz
git-b4100f366c1e5adf3a254cdc6f832aa1a4461053.tar.bz2
Merge branch 'jt/lazy-fetch'
Updates to on-demand fetching code in lazily cloned repositories. * jt/lazy-fetch: fetch: no FETCH_HEAD display if --no-write-fetch-head fetch-pack: remove no_dependents code promisor-remote: lazy-fetch objects in subprocess fetch-pack: do not lazy-fetch during ref iteration fetch: only populate existing_refs if needed fetch: avoid reading submodule config until needed fetch: allow refspecs specified through stdin negotiator/noop: add noop fetch negotiator
Diffstat (limited to 'negotiator/noop.c')
-rw-r--r--negotiator/noop.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/negotiator/noop.c b/negotiator/noop.c
new file mode 100644
index 0000000..60569b8
--- /dev/null
+++ b/negotiator/noop.c
@@ -0,0 +1,44 @@
+#include "cache.h"
+#include "noop.h"
+#include "../commit.h"
+#include "../fetch-negotiator.h"
+
+static void known_common(struct fetch_negotiator *n, struct commit *c)
+{
+ /* do nothing */
+}
+
+static void add_tip(struct fetch_negotiator *n, struct commit *c)
+{
+ /* do nothing */
+}
+
+static const struct object_id *next(struct fetch_negotiator *n)
+{
+ return NULL;
+}
+
+static int ack(struct fetch_negotiator *n, struct commit *c)
+{
+ /*
+ * This negotiator does not emit any commits, so there is no commit to
+ * be acknowledged. If there is any ack, there is a bug.
+ */
+ BUG("ack with noop negotiator, which does not emit any commits");
+ return 0;
+}
+
+static void release(struct fetch_negotiator *n)
+{
+ /* nothing to release */
+}
+
+void noop_negotiator_init(struct fetch_negotiator *negotiator)
+{
+ negotiator->known_common = known_common;
+ negotiator->add_tip = add_tip;
+ negotiator->next = next;
+ negotiator->ack = ack;
+ negotiator->release = release;
+ negotiator->data = NULL;
+}