git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
82ac80aa04fa84d1e1e8c097c0111d345b82c37d blob 2089 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
 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
 
#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_do_init(int force)
{
	static int initialized;

	if ((!force && initialized) || !use_external_odb)
		return;
	initialized = 1;

	git_config(external_odb_config, NULL);
}

static inline void external_odb_init(void)
{
	external_odb_do_init(0);
}

inline void external_odb_reinit(void)
{
	external_odb_do_init(1);
}

int has_external_odb(void)
{
	external_odb_init();

	return !!helpers;
}

struct odb_helper *find_odb_helper(const char *dealer, enum odb_helper_type type)
{
	struct odb_helper *o;

	external_odb_init();

	for (o = helpers; o; o = o->next)
		if (!strcmp(o->dealer, dealer) && o->type == type)
			return o;

	return 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;
}

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

	external_odb_init();

	for (o = helpers; o; o = o->next) {
		if (odb_helper_get_direct(o, sha1) < 0)
			continue;
		return 0;
	}

	return -1;
}
debug log:

solving 82ac80aa04 ...
found 82ac80aa04 in https://public-inbox.org/git/20180319133147.15413-9-chriscool@tuxfamily.org/
found 9c77180d6c in https://public-inbox.org/git/20180319133147.15413-8-chriscool@tuxfamily.org/
found 5d0afb9762 in https://public-inbox.org/git/20180319133147.15413-6-chriscool@tuxfamily.org/ ||
	https://public-inbox.org/git/20180103163403.11303-11-chriscool@tuxfamily.org/
found d26e63d8b1 in https://public-inbox.org/git/20180319133147.15413-5-chriscool@tuxfamily.org/ ||
	https://public-inbox.org/git/20180103163403.11303-4-chriscool@tuxfamily.org/
found 390958dbfe in https://public-inbox.org/git/20180319133147.15413-4-chriscool@tuxfamily.org/ ||
	https://public-inbox.org/git/20180103163403.11303-3-chriscool@tuxfamily.org/
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/10] 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...
9: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

applying [2/10] https://public-inbox.org/git/20180319133147.15413-4-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
index f3ea491333..390958dbfe 100644

Checking patch external-odb.c...
Applied patch external-odb.c cleanly.

skipping https://public-inbox.org/git/20180103163403.11303-3-chriscool@tuxfamily.org/ for 390958dbfe
index at:
100644 390958dbfec20409e7b9aade6993ace6ff688605	external-odb.c

applying [3/10] https://public-inbox.org/git/20180319133147.15413-5-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
index 390958dbfe..d26e63d8b1 100644

Checking patch external-odb.c...
Applied patch external-odb.c cleanly.

skipping https://public-inbox.org/git/20180103163403.11303-4-chriscool@tuxfamily.org/ for d26e63d8b1
index at:
100644 d26e63d8b1dcba756b374bea0ff58de864215ca9	external-odb.c

applying [4/10] https://public-inbox.org/git/20180319133147.15413-6-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
index d26e63d8b1..5d0afb9762 100644

Checking patch external-odb.c...
Applied patch external-odb.c cleanly.

skipping https://public-inbox.org/git/20180103163403.11303-11-chriscool@tuxfamily.org/ for 5d0afb9762
index at:
100644 5d0afb9762069b8351adc104eec6ae945df3cc40	external-odb.c

applying [5/10] https://public-inbox.org/git/20180319133147.15413-8-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
index 5d0afb9762..9c77180d6c 100644


applying [6/10] https://public-inbox.org/git/20180319133147.15413-9-chriscool@tuxfamily.org/
diff --git a/external-odb.c b/external-odb.c
index 9c77180d6c..82ac80aa04 100644

Checking patch external-odb.c...
Applied patch external-odb.c cleanly.
Checking patch external-odb.c...
Applied patch external-odb.c cleanly.

index at:
100644 82ac80aa04fa84d1e1e8c097c0111d345b82c37d	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).