git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
f3ea4913339d88091227fb073a5603625d93848e blob 1355 bytes (raw)

 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
 
#include "cache.h"
#include "external-odb.h"
#include "odb-helper.h"
#include "config.h"

static struct odb_helper *helpers;
static struct odb_helper **helpers_tail = &helpers;

static struct odb_helper *find_or_create_helper(const char *name, int len)
{
	struct odb_helper *o;

	for (o = helpers; o; o = o->next)
		if (!strncmp(o->name, name, len) && !o->name[len])
			return o;

	o = odb_helper_new(name, len);
	*helpers_tail = o;
	helpers_tail = &o->next;

	return o;
}

static int external_odb_config(const char *var, const char *value, void *data)
{
	struct odb_helper *o;
	const char *name;
	int namelen;
	const char *subkey;

	if (parse_config_key(var, "odb", &name, &namelen, &subkey) < 0)
		return 0;

	o = find_or_create_helper(name, namelen);

	if (!strcmp(subkey, "promisorremote"))
		return git_config_string(&o->dealer, var, value);

	return 0;
}

static void external_odb_init(void)
{
	static int initialized;

	if (initialized)
		return;
	initialized = 1;

	git_config(external_odb_config, NULL);
}

const char *external_odb_root(void)
{
	static const char *root;
	if (!root)
		root = git_pathdup("objects/external");
	return root;
}

int external_odb_has_object(const unsigned char *sha1)
{
	struct odb_helper *o;

	external_odb_init();

	for (o = helpers; o; o = o->next)
		if (odb_helper_has_object(o, sha1))
			return 1;
	return 0;
}

debug log:

solving f3ea491333 ...
found f3ea491333 in https://public-inbox.org/git/20180319133147.15413-2-chriscool@tuxfamily.org/ ||
	https://public-inbox.org/git/20180103163403.11303-2-chriscool@tuxfamily.org/

applying [1/2] https://public-inbox.org/git/20180319133147.15413-2-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
new file mode 100644
index 0000000000..f3ea491333

Checking patch external-odb.c...
1:78: new blank line at EOF.
+
Applied patch external-odb.c cleanly.
warning: 1 line adds whitespace errors.

skipping https://public-inbox.org/git/20180103163403.11303-2-chriscool@tuxfamily.org/ for f3ea491333
index at:
100644 f3ea4913339d88091227fb073a5603625d93848e	external-odb.c

Code repositories for project(s) associated with this 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).