diff options
author | Vincent Ambo <mail@tazj.in> | 2021-09-21T10·03+0300 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2021-09-21T11·29+0300 |
commit | 43b1791ec601732ac31195df96781a848360a9ac (patch) | |
tree | daae8d638343295d2f1f7da955e556ef4c958864 /third_party/git/t/helper/test-repository.c | |
parent | 2d8e7dc9d9c38127ec4ebd13aee8e8f586a43318 (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-repository.c')
-rw-r--r-- | third_party/git/t/helper/test-repository.c | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/third_party/git/t/helper/test-repository.c b/third_party/git/t/helper/test-repository.c deleted file mode 100644 index 56f0e3c1bef2..000000000000 --- a/third_party/git/t/helper/test-repository.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "test-tool.h" -#include "cache.h" -#include "commit-graph.h" -#include "commit.h" -#include "config.h" -#include "object-store.h" -#include "object.h" -#include "repository.h" -#include "tree.h" - -static void test_parse_commit_in_graph(const char *gitdir, const char *worktree, - const struct object_id *commit_oid) -{ - struct repository r; - struct commit *c; - struct commit_list *parent; - - setup_git_env(gitdir); - - memset(the_repository, 0, sizeof(*the_repository)); - - if (repo_init(&r, gitdir, worktree)) - die("Couldn't init repo"); - - repo_set_hash_algo(the_repository, hash_algo_by_ptr(r.hash_algo)); - - c = lookup_commit(&r, commit_oid); - - if (!parse_commit_in_graph(&r, c)) - die("Couldn't parse commit"); - - printf("%"PRItime, c->date); - for (parent = c->parents; parent; parent = parent->next) - printf(" %s", oid_to_hex(&parent->item->object.oid)); - printf("\n"); - - repo_clear(&r); -} - -static void test_get_commit_tree_in_graph(const char *gitdir, - const char *worktree, - const struct object_id *commit_oid) -{ - struct repository r; - struct commit *c; - struct tree *tree; - - setup_git_env(gitdir); - - memset(the_repository, 0, sizeof(*the_repository)); - - if (repo_init(&r, gitdir, worktree)) - die("Couldn't init repo"); - - repo_set_hash_algo(the_repository, hash_algo_by_ptr(r.hash_algo)); - - c = lookup_commit(&r, commit_oid); - - /* - * get_commit_tree_in_graph does not automatically parse the commit, so - * parse it first. - */ - if (!parse_commit_in_graph(&r, c)) - die("Couldn't parse commit"); - tree = get_commit_tree_in_graph(&r, c); - if (!tree) - die("Couldn't get commit tree"); - - printf("%s\n", oid_to_hex(&tree->object.oid)); - - repo_clear(&r); -} - -int cmd__repository(int argc, const char **argv) -{ - int nongit_ok = 0; - - setup_git_directory_gently(&nongit_ok); - - if (argc < 2) - die("must have at least 2 arguments"); - if (!strcmp(argv[1], "parse_commit_in_graph")) { - struct object_id oid; - if (argc < 5) - die("not enough arguments"); - if (parse_oid_hex(argv[4], &oid, &argv[4])) - die("cannot parse oid '%s'", argv[4]); - test_parse_commit_in_graph(argv[2], argv[3], &oid); - } else if (!strcmp(argv[1], "get_commit_tree_in_graph")) { - struct object_id oid; - if (argc < 5) - die("not enough arguments"); - if (parse_oid_hex(argv[4], &oid, &argv[4])) - die("cannot parse oid '%s'", argv[4]); - test_get_commit_tree_in_graph(argv[2], argv[3], &oid); - } else { - die("unrecognized '%s'", argv[1]); - } - return 0; -} |