Skip to content

Commit

Permalink
Update git-core to v2.46.0-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jul 28, 2024
1 parent 7feb98a commit dfddeda
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CI/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion git-core
Submodule git-core updated 906 files
12 changes: 8 additions & 4 deletions src/cinnabar-fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions src/cinnabar-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -380,7 +381,7 @@ int init_cinnabar(const char *argv0)

git_setup_gettext();

initialize_the_repository();
initialize_repository(the_repository);

attr_start();

Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/cinnabar-notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/hg-connect-stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/hg-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/hg_connect_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl HttpRequest {
if let Some(log_target) = &this.log_target {
trace!(target: &log_target, "Request required reauthentication");
}
unsafe { credential_fill(ptr::addr_of_mut!(http_auth)) };
unsafe { credential_fill(ptr::addr_of_mut!(http_auth), 1) };
this.execute_once()
} else {
Err((result, this))
Expand Down
20 changes: 10 additions & 10 deletions src/http.c.patch
Original file line number Diff line number Diff line change
@@ -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;
}
Expand All @@ -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);
Expand Down
17 changes: 14 additions & 3 deletions src/libgit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ macro_rules! die {
pub(crate) use die;

extern "C" {
pub fn credential_fill(auth: *mut credential);
pub fn credential_fill(auth: *mut credential, all_capabilities: c_int);

pub static mut http_auth: credential;

Expand Down Expand Up @@ -986,14 +986,19 @@ pub fn for_each_ref_in<E, S: AsRef<OsStr>, 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<S: AsRef<OsStr>>(refname: S) -> Option<CommitId> {
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 {
Expand Down Expand Up @@ -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,
Expand All @@ -1032,6 +1039,7 @@ extern "C" {
tr: *mut ref_transaction,
refname: *const c_char,
old_oid: *const object_id,
old_target: *const c_char,
flags: c_uint,
msg: *const c_char,
err: *mut strbuf,
Expand Down Expand Up @@ -1098,6 +1106,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,
Expand All @@ -1124,6 +1134,7 @@ impl RefTransaction {
self.tr,
refname.as_ref().to_cstring().as_ptr(),
old_oid.map(object_id::from).as_ref().as_ptr(),
ptr::null(),
0,
msg.as_ptr(),
&mut self.err,
Expand Down
13 changes: 3 additions & 10 deletions src/mingw.c.patch
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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());
8 changes: 4 additions & 4 deletions src/tree-walk.c.patch
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit dfddeda

Please sign in to comment.