about summary refs log tree commit diff
path: root/third_party/git/t/helper/test-oidmap.c
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-09-21T10·03+0300
committerVincent Ambo <mail@tazj.in>2021-09-21T11·29+0300
commit43b1791ec601732ac31195df96781a848360a9ac (patch)
treedaae8d638343295d2f1f7da955e556ef4c958864 /third_party/git/t/helper/test-oidmap.c
parent2d8e7dc9d9c38127ec4ebd13aee8e8f586a43318 (diff)
chore(3p/git): Unvendor git and track patches instead r/2903
This was vendored a long time ago under the expectation that keeping
it in sync with cgit would be easier this way, but it has proven not
to be a big issue.

On the other hand, a vendored copy of git is an annoying maintenance
burden. It is much easier to rebase the single (dottime) patch that we
have.

This removes the vendored copy of git and instead passes the git
source code to cgit via `pkgs.srcOnly`, which includes the applied
patch so that cgit can continue rendering dottime.

Change-Id: If31f62dea7ce688fd1b9050204e9378019775f2b
Diffstat (limited to 'third_party/git/t/helper/test-oidmap.c')
-rw-r--r--third_party/git/t/helper/test-oidmap.c112
1 files changed, 0 insertions, 112 deletions
diff --git a/third_party/git/t/helper/test-oidmap.c b/third_party/git/t/helper/test-oidmap.c
deleted file mode 100644
index 0acf99931ee1..000000000000
--- a/third_party/git/t/helper/test-oidmap.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "test-tool.h"
-#include "cache.h"
-#include "oidmap.h"
-#include "strbuf.h"
-
-/* key is an oid and value is a name (could be a refname for example) */
-struct test_entry {
-	struct oidmap_entry entry;
-	char name[FLEX_ARRAY];
-};
-
-#define DELIM " \t\r\n"
-
-/*
- * Read stdin line by line and print result of commands to stdout:
- *
- * hash oidkey -> sha1hash(oidkey)
- * put oidkey namevalue -> NULL / old namevalue
- * get oidkey -> NULL / namevalue
- * remove oidkey -> NULL / old namevalue
- * iterate -> oidkey1 namevalue1\noidkey2 namevalue2\n...
- *
- */
-int cmd__oidmap(int argc, const char **argv)
-{
-	struct strbuf line = STRBUF_INIT;
-	struct oidmap map = OIDMAP_INIT;
-
-	setup_git_directory();
-
-	/* init oidmap */
-	oidmap_init(&map, 0);
-
-	/* process commands from stdin */
-	while (strbuf_getline(&line, stdin) != EOF) {
-		char *cmd, *p1 = NULL, *p2 = NULL;
-		struct test_entry *entry;
-		struct object_id oid;
-
-		/* break line into command and up to two parameters */
-		cmd = strtok(line.buf, DELIM);
-		/* ignore empty lines */
-		if (!cmd || *cmd == '#')
-			continue;
-
-		p1 = strtok(NULL, DELIM);
-		if (p1)
-			p2 = strtok(NULL, DELIM);
-
-		if (!strcmp("put", cmd) && p1 && p2) {
-
-			if (get_oid(p1, &oid)) {
-				printf("Unknown oid: %s\n", p1);
-				continue;
-			}
-
-			/* create entry with oid_key = p1, name_value = p2 */
-			FLEX_ALLOC_STR(entry, name, p2);
-			oidcpy(&entry->entry.oid, &oid);
-
-			/* add / replace entry */
-			entry = oidmap_put(&map, entry);
-
-			/* print and free replaced entry, if any */
-			puts(entry ? entry->name : "NULL");
-			free(entry);
-
-		} else if (!strcmp("get", cmd) && p1) {
-
-			if (get_oid(p1, &oid)) {
-				printf("Unknown oid: %s\n", p1);
-				continue;
-			}
-
-			/* lookup entry in oidmap */
-			entry = oidmap_get(&map, &oid);
-
-			/* print result */
-			puts(entry ? entry->name : "NULL");
-
-		} else if (!strcmp("remove", cmd) && p1) {
-
-			if (get_oid(p1, &oid)) {
-				printf("Unknown oid: %s\n", p1);
-				continue;
-			}
-
-			/* remove entry from oidmap */
-			entry = oidmap_remove(&map, &oid);
-
-			/* print result and free entry*/
-			puts(entry ? entry->name : "NULL");
-			free(entry);
-
-		} else if (!strcmp("iterate", cmd)) {
-
-			struct oidmap_iter iter;
-			oidmap_iter_init(&map, &iter);
-			while ((entry = oidmap_iter_next(&iter)))
-				printf("%s %s\n", oid_to_hex(&entry->entry.oid), entry->name);
-
-		} else {
-
-			printf("Unknown command %s\n", cmd);
-
-		}
-	}
-
-	strbuf_release(&line);
-	oidmap_free(&map, 1);
-	return 0;
-}