The second batch
[git] / negotiator / noop.c
1 #include "cache.h"
2 #include "noop.h"
3 #include "../commit.h"
4 #include "../fetch-negotiator.h"
5
6 static void known_common(struct fetch_negotiator *n, struct commit *c)
7 {
8         /* do nothing */
9 }
10
11 static void add_tip(struct fetch_negotiator *n, struct commit *c)
12 {
13         /* do nothing */
14 }
15
16 static const struct object_id *next(struct fetch_negotiator *n)
17 {
18         return NULL;
19 }
20
21 static int ack(struct fetch_negotiator *n, struct commit *c)
22 {
23         /*
24          * This negotiator does not emit any commits, so there is no commit to
25          * be acknowledged. If there is any ack, there is a bug.
26          */
27         BUG("ack with noop negotiator, which does not emit any commits");
28         return 0;
29 }
30
31 static void release(struct fetch_negotiator *n)
32 {
33         /* nothing to release */
34 }
35
36 void noop_negotiator_init(struct fetch_negotiator *negotiator)
37 {
38         negotiator->known_common = known_common;
39         negotiator->add_tip = add_tip;
40         negotiator->next = next;
41         negotiator->ack = ack;
42         negotiator->release = release;
43         negotiator->data = NULL;
44 }