git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob b2c9c160a529ed7ec6ad270f49caf51fd46c558b 3495 bytes (raw)
name: bundle-uri.h 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
#ifndef BUNDLE_URI_H
#define BUNDLE_URI_H

#include "hashmap.h"
#include "strbuf.h"

struct packet_reader;
struct repository;
struct string_list;

/**
 * The remote_bundle_info struct contains information for a single bundle
 * URI. This may be initialized simply by a given URI or might have
 * additional metadata associated with it if the bundle was advertised by
 * a bundle list.
 */
struct remote_bundle_info {
	struct hashmap_entry ent;

	/**
	 * The 'id' is a name given to the bundle for reference
	 * by other bundle infos.
	 */
	char *id;

	/**
	 * The 'uri' is the location of the remote bundle so
	 * it can be downloaded on-demand. This will be NULL
	 * if there was no table of contents.
	 */
	char *uri;

	/**
	 * If the bundle has been downloaded, then 'file' is a
	 * filename storing its contents. Otherwise, 'file' is
	 * NULL.
	 */
	char *file;

	/**
	 * If the bundle has been unbundled successfully, then
	 * this boolean is true.
	 */
	unsigned unbundled:1;
};

#define REMOTE_BUNDLE_INFO_INIT { 0 }

enum bundle_list_mode {
	BUNDLE_MODE_NONE = 0,
	BUNDLE_MODE_ALL,
	BUNDLE_MODE_ANY
};

/**
 * A bundle_list contains an unordered set of remote_bundle_info structs,
 * as well as information about the bundle listing, such as version and
 * mode.
 */
struct bundle_list {
	int version;
	enum bundle_list_mode mode;
	struct hashmap bundles;

	/**
	 * The baseURI of a bundle_list is the URI that provided the list.
	 *
	 * In the case of the 'bundle-uri' protocol v2 command, the base
	 * URI is the URI of the Git remote.
	 *
	 * Otherewise, the bundle list was downloaded over HTTP from some
	 * known URI.
	 *
	 * The baseURI is used as the base for any relative URIs
	 * advertised by the bundle list at that location.
	 */
	char *baseURI;
};

void init_bundle_list(struct bundle_list *list);
void clear_bundle_list(struct bundle_list *list);

typedef int (*bundle_iterator)(struct remote_bundle_info *bundle,
			       void *data);

int for_all_bundles_in_list(struct bundle_list *list,
			    bundle_iterator iter,
			    void *data);

struct FILE;
void print_bundle_list(FILE *fp, struct bundle_list *list);

/**
 * A bundle URI may point to a bundle list where the key=value
 * pairs are provided in config file format. This method is
 * exposed publicly for testing purposes.
 */
int bundle_uri_parse_config_format(const char *uri,
				   const char *filename,
				   struct bundle_list *list);

/**
 * Fetch data from the given 'uri' and unbundle the bundle data found
 * based on that information.
 *
 * Returns non-zero if no bundle information is found at the given 'uri'.
 */
int fetch_bundle_uri(struct repository *r, const char *uri);

/**
 * Given a bundle list that was already advertised (likely by the
 * bundle-uri protocol v2 verb) at the given uri, fetch and unbundle the
 * bundles according to the bundle strategy of that list.
 *
 * Returns non-zero if no bundle information is found at the given 'uri'.
 */
int fetch_bundle_list(struct repository *r,
		      const char *uri,
		      struct bundle_list *list);

/**
 * API for serve.c.
 */
int bundle_uri_advertise(struct repository *r, struct strbuf *value);
int bundle_uri_command(struct repository *r, struct packet_reader *request);

/**
 * General API for {transport,connect}.c etc.
 */

/**
 * Parse a "key=value" packet line from the bundle-uri verb.
 *
 * Returns 0 on success and non-zero on error.
 */
int bundle_uri_parse_line(struct bundle_list *list,
			  const char *line);

#endif

debug log:

solving b2c9c160a52 ...
found b2c9c160a52 in https://public-inbox.org/git/69bf154bec63a22df8e5eac89f975625ce73c8ac.1670262639.git.gitgitgadget@gmail.com/
found e7e90a5f088 in https://public-inbox.org/git/48731438d6a289129a5768b80af856fb49692426.1670262639.git.gitgitgadget@gmail.com/
found 357111ecce8 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 357111ecce87d09bc4a73043d2dc98b2a6badbf2	bundle-uri.h

applying [1/2] https://public-inbox.org/git/48731438d6a289129a5768b80af856fb49692426.1670262639.git.gitgitgadget@gmail.com/
diff --git a/bundle-uri.h b/bundle-uri.h
index 357111ecce8..e7e90a5f088 100644


applying [2/2] https://public-inbox.org/git/69bf154bec63a22df8e5eac89f975625ce73c8ac.1670262639.git.gitgitgadget@gmail.com/
diff --git a/bundle-uri.h b/bundle-uri.h
index e7e90a5f088..b2c9c160a52 100644

Checking patch bundle-uri.h...
Applied patch bundle-uri.h cleanly.
Checking patch bundle-uri.h...
Applied patch bundle-uri.h cleanly.

index at:
100644 b2c9c160a529ed7ec6ad270f49caf51fd46c558b	bundle-uri.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).