git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
d472ff5dc6a1b0559427c558686ea67ee35dfc5c blob 1623 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
 
#include "test-tool.h"
#include "unique-prefix.h"

static size_t test_count, failed_count;

static void check(int succeeded, const char *file, size_t line_no,
		  const char *fmt, ...)
{
	va_list ap;

	test_count++;
	if (succeeded)
		return;

	va_start(ap, fmt);
	fprintf(stderr, "%s:%d: ", file, (int)line_no);
	vfprintf(stderr, fmt, ap);
	fputc('\n', stderr);
	va_end(ap);

	failed_count++;
}

#define EXPECT_SIZE_T_EQUALS(expect, actual, hint) \
	check(expect == actual, __FILE__, __LINE__, \
	      "size_t's do not match: expected: %" \
	      PRIdMAX " got: %" PRIdMAX " (%s) (%s)", \
	      (intmax_t)expect, (intmax_t)actual, #actual, hint)

int cmd__prefix_map(int argc, const char **argv)
{
	size_t i;
	struct prefix_item items[] = {
		{ "unique" },
		{ "hell" },
		{ "hello" },
		{ "wok" },
		{ "world" },
		{ "a" },
		{ "" },
		{ "pq" },
		{ "pq" },
		{ "pqr" },
	};
	struct prefix_item *list[ARRAY_SIZE(items)];
	for (i = 0; i < ARRAY_SIZE(items); i++) {
		list[i] = &items[i];
		list[i]->prefix_length = 12345; /* dummy */
	}

	find_unique_prefixes(list, ARRAY_SIZE(list), 1, 3);

#define EXPECT_PREFIX_LENGTH_EQUALS(expect, index) \
	EXPECT_SIZE_T_EQUALS(expect, list[index]->prefix_length, \
			     list[index]->name)

	EXPECT_PREFIX_LENGTH_EQUALS(1, 0);
	EXPECT_PREFIX_LENGTH_EQUALS(0, 1);
	EXPECT_PREFIX_LENGTH_EQUALS(0, 2);
	EXPECT_PREFIX_LENGTH_EQUALS(3, 3);
	EXPECT_PREFIX_LENGTH_EQUALS(3, 4);
	EXPECT_PREFIX_LENGTH_EQUALS(1, 5);
	EXPECT_PREFIX_LENGTH_EQUALS(0, 6);
	EXPECT_PREFIX_LENGTH_EQUALS(0, 7);
	EXPECT_PREFIX_LENGTH_EQUALS(0, 8);
	EXPECT_PREFIX_LENGTH_EQUALS(3, 9);

	return !!failed_count;
}
debug log:

solving d472ff5dc6 ...
found d472ff5dc6 in https://public-inbox.org/git/20190828163419.30620-1-szeder.dev@gmail.com/
found 3f1c90eaf0 in https://public-inbox.org/git/db1ede363645b0620d4924639efe5ec708441aa7.1554917868.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/3000d7d08dfb64511b4ebf9d05617897dd7252f7.1563289115.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/e02a52c3acf64657c012744108d7ccc3ecdf1b43.1557768471.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/c5a699b6b27e04cf341a20258702bb6d3df917e5.1566910672.git.gitgitgadget@gmail.com/

applying [1/5] https://public-inbox.org/git/db1ede363645b0620d4924639efe5ec708441aa7.1554917868.git.gitgitgadget@gmail.com/
diff --git a/t/helper/test-prefix-map.c b/t/helper/test-prefix-map.c
new file mode 100644
index 0000000000..3f1c90eaf0

Checking patch t/helper/test-prefix-map.c...
Applied patch t/helper/test-prefix-map.c cleanly.

skipping https://public-inbox.org/git/3000d7d08dfb64511b4ebf9d05617897dd7252f7.1563289115.git.gitgitgadget@gmail.com/ for 3f1c90eaf0
skipping https://public-inbox.org/git/e02a52c3acf64657c012744108d7ccc3ecdf1b43.1557768471.git.gitgitgadget@gmail.com/ for 3f1c90eaf0
skipping https://public-inbox.org/git/c5a699b6b27e04cf341a20258702bb6d3df917e5.1566910672.git.gitgitgadget@gmail.com/ for 3f1c90eaf0
index at:
100644 3f1c90eaf04361c9cbaf8d32e1178985e4d051f5	t/helper/test-prefix-map.c

applying [2/5] https://public-inbox.org/git/20190828163419.30620-1-szeder.dev@gmail.com/
diff --git a/t/helper/test-prefix-map.c b/t/helper/test-prefix-map.c
index 3f1c90eaf0..d472ff5dc6 100644

Checking patch t/helper/test-prefix-map.c...
Applied patch t/helper/test-prefix-map.c cleanly.

index at:
100644 d472ff5dc6a1b0559427c558686ea67ee35dfc5c	t/helper/test-prefix-map.c

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git