Elijah Newren | a64215b | 2023-02-24 00:09:30 +0000 | [diff] [blame] | 1 | #include "git-compat-util.h" |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 2 | #include "noop.h" |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 3 | #include "../fetch-negotiator.h" |
| 4 | |
Jeff King | 06b217f | 2023-08-29 19:45:30 -0400 | [diff] [blame] | 5 | static void known_common(struct fetch_negotiator *n UNUSED, |
| 6 | struct commit *c UNUSED) |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 7 | { |
| 8 | /* do nothing */ |
| 9 | } |
| 10 | |
Jeff King | 06b217f | 2023-08-29 19:45:30 -0400 | [diff] [blame] | 11 | static void add_tip(struct fetch_negotiator *n UNUSED, |
| 12 | struct commit *c UNUSED) |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 13 | { |
| 14 | /* do nothing */ |
| 15 | } |
| 16 | |
Jeff King | 06b217f | 2023-08-29 19:45:30 -0400 | [diff] [blame] | 17 | static const struct object_id *next(struct fetch_negotiator *n UNUSED) |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 18 | { |
| 19 | return NULL; |
| 20 | } |
| 21 | |
Jeff King | 06b217f | 2023-08-29 19:45:30 -0400 | [diff] [blame] | 22 | static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED) |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 23 | { |
| 24 | /* |
| 25 | * This negotiator does not emit any commits, so there is no commit to |
| 26 | * be acknowledged. If there is any ack, there is a bug. |
| 27 | */ |
| 28 | BUG("ack with noop negotiator, which does not emit any commits"); |
| 29 | return 0; |
| 30 | } |
| 31 | |
Jeff King | 06b217f | 2023-08-29 19:45:30 -0400 | [diff] [blame] | 32 | static void release(struct fetch_negotiator *n UNUSED) |
Jonathan Tan | cbe566a | 2020-08-17 21:01:31 -0700 | [diff] [blame] | 33 | { |
| 34 | /* nothing to release */ |
| 35 | } |
| 36 | |
| 37 | void noop_negotiator_init(struct fetch_negotiator *negotiator) |
| 38 | { |
| 39 | negotiator->known_common = known_common; |
| 40 | negotiator->add_tip = add_tip; |
| 41 | negotiator->next = next; |
| 42 | negotiator->ack = ack; |
| 43 | negotiator->release = release; |
| 44 | negotiator->data = NULL; |
| 45 | } |