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/checkout.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/checkout.c')
-rw-r--r-- | third_party/git/checkout.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/third_party/git/checkout.c b/third_party/git/checkout.c deleted file mode 100644 index 6586e30ca5a6..000000000000 --- a/third_party/git/checkout.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "cache.h" -#include "remote.h" -#include "refspec.h" -#include "checkout.h" -#include "config.h" - -struct tracking_name_data { - /* const */ char *src_ref; - char *dst_ref; - struct object_id *dst_oid; - int num_matches; - const char *default_remote; - char *default_dst_ref; - struct object_id *default_dst_oid; -}; - -#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL, 0, NULL, NULL, NULL } - -static int check_tracking_name(struct remote *remote, void *cb_data) -{ - struct tracking_name_data *cb = cb_data; - struct refspec_item query; - memset(&query, 0, sizeof(struct refspec_item)); - query.src = cb->src_ref; - if (remote_find_tracking(remote, &query) || - get_oid(query.dst, cb->dst_oid)) { - free(query.dst); - return 0; - } - cb->num_matches++; - if (cb->default_remote && !strcmp(remote->name, cb->default_remote)) { - struct object_id *dst = xmalloc(sizeof(*cb->default_dst_oid)); - cb->default_dst_ref = xstrdup(query.dst); - oidcpy(dst, cb->dst_oid); - cb->default_dst_oid = dst; - } - if (cb->dst_ref) { - free(query.dst); - return 0; - } - cb->dst_ref = query.dst; - return 0; -} - -const char *unique_tracking_name(const char *name, struct object_id *oid, - int *dwim_remotes_matched) -{ - struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT; - const char *default_remote = NULL; - if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote)) - cb_data.default_remote = default_remote; - cb_data.src_ref = xstrfmt("refs/heads/%s", name); - cb_data.dst_oid = oid; - for_each_remote(check_tracking_name, &cb_data); - if (dwim_remotes_matched) - *dwim_remotes_matched = cb_data.num_matches; - free(cb_data.src_ref); - if (cb_data.num_matches == 1) { - free(cb_data.default_dst_ref); - free(cb_data.default_dst_oid); - return cb_data.dst_ref; - } - free(cb_data.dst_ref); - if (cb_data.default_dst_ref) { - oidcpy(oid, cb_data.default_dst_oid); - free(cb_data.default_dst_oid); - return cb_data.default_dst_ref; - } - return NULL; -} |