diff --git a/CI/tools.py b/CI/tools.py index ea9e6ca65..26bdd02a1 100644 --- a/CI/tools.py +++ b/CI/tools.py @@ -17,7 +17,7 @@ MERCURIAL_VERSION = '6.8' -GIT_VERSION = '2.45.2' +GIT_VERSION = '2.46.0-rc2' ALL_MERCURIAL_VERSIONS = ( '1.9.3', '2.0.2', '2.1.2', '2.2.3', '2.3.2', '2.4.2', '2.5.4', diff --git a/git-core b/git-core index 91d03cb2e..102af53c0 160000 --- a/git-core +++ b/git-core @@ -1 +1 @@ -Subproject commit 91d03cb2e4fbf6ad961ace739b8a646868cb154d +Subproject commit 102af53c0cdd21dc0b8da493e4bfe79f6f0652ac diff --git a/src/cinnabar-fast-import.c b/src/cinnabar-fast-import.c index 44256237b..6098d84bd 100644 --- a/src/cinnabar-fast-import.c +++ b/src/cinnabar-fast-import.c @@ -2,12 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" struct object_id; static void start_packfile(void); static void cinnabar_unregister_shallow(const struct object_id *oid); #include "alloc.h" #include "dir.h" +#undef fspathncmp #define fspathncmp strncmp #include "fast-import.patched.c" #include "cinnabar-fast-import.h" @@ -117,7 +119,7 @@ off_t find_pack_entry_one(const unsigned char *sha1, struct packed_git *p) if (p == pack_data) { struct object_id oid; struct object_entry *oe; - oidread(&oid, sha1); + oidread(&oid, sha1, the_repository->hash_algo); oe = get_object_entry(&oid); if (oe) return oe->idx.offset; @@ -388,10 +390,12 @@ void store_manifest(struct Store *store, struct rev_chunk *chunk, last_manifest->branch_tree.tree); last_manifest->branch_tree.tree = NULL; } - oidclr(&last_manifest->branch_tree.versions[0].oid); - oidclr(&last_manifest->branch_tree.versions[1].oid); + oidclr(&last_manifest->branch_tree.versions[0].oid, + the_repository->hash_algo); + oidclr(&last_manifest->branch_tree.versions[1].oid, + the_repository->hash_algo); hg_oidclr(&last_manifest_oid); - oidclr(&last_manifest->oid); + oidclr(&last_manifest->oid, the_repository->hash_algo); assert(last_manifest_content.len == 0); } else if (!hg_oideq(chunk->delta_node, &last_manifest_oid)) { const struct object_id *note; diff --git a/src/cinnabar-helper.c b/src/cinnabar-helper.c index 447918118..16ec1c3dd 100644 --- a/src/cinnabar-helper.c +++ b/src/cinnabar-helper.c @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define USE_THE_REPOSITORY_VARIABLE #include #include #include @@ -273,8 +274,8 @@ const char *remote_get_name(const struct remote *remote) void remote_get_url(const struct remote *remote, const char * const **url, int* url_nr) { - *url = remote->url; - *url_nr = remote->url_nr; + *url = remote->url.v; + *url_nr = remote->url.nr; } int remote_skip_default_update(const struct remote *remote) @@ -380,7 +381,7 @@ int init_cinnabar(const char *argv0) git_setup_gettext(); - initialize_the_repository(); + initialize_repository(the_repository); attr_start(); @@ -402,8 +403,9 @@ int init_cinnabar(const char *argv0) // that weird git 2.44 case. struct strbuf err = STRBUF_INIT; check_repository_format(NULL); - if (refs_init_db(get_main_ref_store(the_repository), - 0, &err)) + if (ref_store_create_on_disk( + get_main_ref_store(the_repository), + 0, &err)) die("failed to set up refs db: %s", err.buf); nongit = 0; } else { diff --git a/src/cinnabar-notes.c b/src/cinnabar-notes.c index 7252522c5..d7b156d61 100644 --- a/src/cinnabar-notes.c +++ b/src/cinnabar-notes.c @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "hash.h" #include "cinnabar-notes.h" @@ -131,7 +132,7 @@ int cinnabar_remove_note(struct cinnabar_notes_tree *t, int result2 = remove_note(&t->additions, object_sha1); if (!result) { struct object_id oid; - oidread(&oid, object_sha1); + oidread(&oid, object_sha1, the_repository->hash_algo); add_note(&t->additions, &oid, null_oid(), NULL); } return result && result2; diff --git a/src/hg-connect-stdio.c b/src/hg-connect-stdio.c index a76d0bf15..20a8d34e1 100644 --- a/src/hg-connect-stdio.c +++ b/src/hg-connect-stdio.c @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "hg-connect.h" #include "hg-bundle.h" diff --git a/src/hg-data.c b/src/hg-data.c index 0cc2cc022..45257ab08 100644 --- a/src/hg-data.c +++ b/src/hg-data.c @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "hg-data.h" diff --git a/src/http.c.patch b/src/http.c.patch index 6f6f937ba..03a232d1f 100644 --- a/src/http.c.patch +++ b/src/http.c.patch @@ -1,17 +1,17 @@ diff --git a/http.c b/http.c -index 239421a983..8d1086ca4d 100644 +index c89f96ceba..d6284df1e2 100644 --- a/http.c +++ b/http.c -@@ -68,7 +68,7 @@ static const char *curl_no_proxy; +@@ -68,7 +68,7 @@ static char *curl_no_proxy; #ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY - static const char *ssl_pinnedkey; + static char *ssl_pinnedkey; #endif --static const char *ssl_cainfo; -+const char *ssl_cainfo; +-static char *ssl_cainfo; ++char *ssl_cainfo; static long curl_low_speed_limit = -1; static long curl_low_speed_time = -1; static int curl_ftp_no_epsv; -@@ -406,11 +406,13 @@ static int http_options(const char *var, const char *value, +@@ -423,11 +423,13 @@ static int http_options(const char *var, const char *value, curl_ssl_try = git_config_bool(var, value); return 0; } @@ -25,17 +25,17 @@ index 239421a983..8d1086ca4d 100644 if (!strcmp("http.schannelcheckrevoke", var)) { if (value && !strcmp(value, "best-effort")) { -@@ -1300,9 +1302,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) +@@ -1369,9 +1371,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) } #endif - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) - die("curl_global_init failed"); - - http_proactive_auth = proactive_auth; + if (proactive_auth && http_proactive_auth == PROACTIVE_AUTH_NONE) + http_proactive_auth = PROACTIVE_AUTH_IF_CREDENTIALS; - if (remote && remote->http_proxy) -@@ -1391,7 +1390,6 @@ void http_cleanup(void) +@@ -1459,7 +1458,6 @@ void http_cleanup(void) curl_easy_cleanup(curl_default); curl_multi_cleanup(curlm); diff --git a/src/libgit.rs b/src/libgit.rs index 09d8fb498..bdbb270d1 100644 --- a/src/libgit.rs +++ b/src/libgit.rs @@ -986,14 +986,19 @@ pub fn for_each_ref_in, F: FnMut(&OsStr, CommitId) -> Result< } extern "C" { - fn read_ref(refname: *const c_char, oid: *mut object_id) -> c_int; + fn refs_read_ref(refs: *const ref_store, refname: *const c_char, oid: *mut object_id) -> c_int; } pub fn resolve_ref>(refname: S) -> Option { let _locked = REFS_LOCK.read().unwrap(); let mut oid = object_id::default(); unsafe { - if read_ref(refname.as_ref().to_cstring().as_ptr(), &mut oid) == 0 { + if refs_read_ref( + get_main_ref_store(the_repository), + refname.as_ref().to_cstring().as_ptr(), + &mut oid, + ) == 0 + { // We ignore tags. See comment in for_each_ref_in. CommitId::try_from(GitObjectId::from(oid)).ok() } else { @@ -1023,6 +1028,8 @@ extern "C" { refname: *const c_char, new_oid: *const object_id, old_oid: *const object_id, + new_target: *const c_char, + old_target: *const c_char, flags: c_uint, msg: *const c_char, err: *mut strbuf, @@ -1098,6 +1105,8 @@ impl RefTransaction { refname.as_ref().to_cstring().as_ptr(), &new_oid.into(), old_oid.map(object_id::from).as_ref().as_ptr(), + ptr::null(), + ptr::null(), 0, msg.as_ptr(), &mut self.err, diff --git a/src/mingw.c.patch b/src/mingw.c.patch index 80b6d767e..310e7b120 100644 --- a/src/mingw.c.patch +++ b/src/mingw.c.patch @@ -1,8 +1,9 @@ diff --git a/compat/mingw.c b/compat/mingw.c -index 303ffaa19f..e87f407f95 100644 +index bb8760deec..dba4f71548 100644 --- a/compat/mingw.c +++ b/compat/mingw.c -@@ -1,30 +1,30 @@ +@@ -1,31 +1,31 @@ + #define USE_THE_REPOSITORY_VARIABLE -#include "../git-compat-util.h" +#include "git-compat-util.h" #include "win32.h" @@ -47,11 +48,3 @@ index 303ffaa19f..e87f407f95 100644 #include "win32/wsl.h" #define HCAST(type, handle) ((type)(intptr_t)handle) -@@ -32,7 +32,6 @@ - void open_in_gdb(void) - { - static struct child_process cp = CHILD_PROCESS_INIT; -- extern char *_pgmptr; - - strvec_pushl(&cp.args, "mintty", "gdb", NULL); - strvec_pushf(&cp.args, "--pid=%d", getpid()); diff --git a/src/tree-walk.c.patch b/src/tree-walk.c.patch index 554a338f4..490421c2b 100644 --- a/src/tree-walk.c.patch +++ b/src/tree-walk.c.patch @@ -1,13 +1,13 @@ diff --git a/tree-walk.c b/tree-walk.c -index 6565d9ad99..4e2a56f5bc 100644 +index a033397965..0d4d2f7a79 100644 --- a/tree-walk.c +++ b/tree-walk.c -@@ -36,7 +36,7 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l +@@ -38,7 +38,7 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l /* Initialize the descriptor entry */ desc->entry.path = path; - desc->entry.mode = (desc->flags & TREE_DESC_RAW_MODES) ? mode : canon_mode(mode); + desc->entry.mode = mode; desc->entry.pathlen = len - 1; - oidread_algop(&desc->entry.oid, (const unsigned char *)path + len, - desc->algo); + oidread(&desc->entry.oid, (const unsigned char *)path + len, + desc->algo);