git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
c6127ce81f224f1badcaa230fb74d946ffea4516 blob 1308 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
 
#include "cache.h"
#include "object.h"
#include "argv-array.h"
#include "odb-helper.h"
#include "run-command.h"
#include "sha1-lookup.h"
#include "fetch-object.h"

struct odb_helper *odb_helper_new(const char *name, int namelen)
{
	struct odb_helper *o;

	o = xcalloc(1, sizeof(*o));
	o->name = xmemdupz(name, namelen);

	return o;
}

struct odb_helper_cmd {
	struct argv_array argv;
	struct child_process child;
};

static void odb_helper_load_have(struct odb_helper *o)
{
	if (o->have_valid)
		return;
	o->have_valid = 1;

	/* TODO */
}

static const unsigned char *have_sha1_access(size_t index, void *table)
{
	struct odb_helper_object *have = table;
	return have[index].oid.hash;
}

static struct odb_helper_object *odb_helper_lookup(struct odb_helper *o,
						   const unsigned char *sha1)
{
	int idx;

	odb_helper_load_have(o);
	idx = sha1_pos(sha1, o->have, o->have_nr, have_sha1_access);
	if (idx < 0)
		return NULL;
	return &o->have[idx];
}

int odb_helper_has_object(struct odb_helper *o, const unsigned char *sha1)
{
	return !!odb_helper_lookup(o, sha1);
}

int odb_helper_get_direct(struct odb_helper *o,
			  const unsigned char *sha1)
{
	int res = 0;
	uint64_t start = getnanotime();

	fetch_object(o->dealer, sha1);

	trace_performance_since(start, "odb_helper_get_direct");

	return res;
}
debug log:

solving c6127ce81f ...
found c6127ce81f in https://public-inbox.org/git/20180319133147.15413-6-chriscool@tuxfamily.org/
found 67196e6317 in https://public-inbox.org/git/20180319133147.15413-2-chriscool@tuxfamily.org/

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


applying [2/2] https://public-inbox.org/git/20180319133147.15413-6-chriscool@tuxfamily.org/
diff --git a/odb-helper.c b/odb-helper.c
index 67196e6317..c6127ce81f 100644

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

index at:
100644 c6127ce81f224f1badcaa230fb74d946ffea4516	odb-helper.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).