summaryrefslogtreecommitdiff
path: root/etc/patches
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 16:59:41 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-02-24 12:14:20 +0100
commit8c5a7b8dc317307f494a83a8d985f5c5ee09a3a4 (patch)
tree214486b1f9b57bf3d81758fcce24c8ea5eedd319 /etc/patches
parentb86388107fda2094060a5e9470728b7be9d750c9 (diff)
downloadjustbuild-8c5a7b8dc317307f494a83a8d985f5c5ee09a3a4.tar.gz
libgit2: Update to v1.5.0
Changes to build description: - new USE_SHA256 flag - removed "Generic" option for USE_SHA1 - updated to the new source code structure (split "src/git2" into "src/libgit2" and "src/util")
Diffstat (limited to 'etc/patches')
-rw-r--r--etc/patches/libgit2_v1.2.0_fix-proxy-settings.patch78
-rw-r--r--etc/patches/libgit2_v1.5.0_fix-fake-repo.patch (renamed from etc/patches/libgit2_v1.2.0_fix-fake-repo.patch)85
2 files changed, 41 insertions, 122 deletions
diff --git a/etc/patches/libgit2_v1.2.0_fix-proxy-settings.patch b/etc/patches/libgit2_v1.2.0_fix-proxy-settings.patch
deleted file mode 100644
index 775ba392..00000000
--- a/etc/patches/libgit2_v1.2.0_fix-proxy-settings.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 9488139554c486fd0691d4b90fb6aff479c0421d Mon Sep 17 00:00:00 2001
-From: Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com>
-Date: Mon, 23 Jan 2023 17:19:02 +0100
-Subject: [PATCH] Correct handling of no_proxy .gitconfig options to match git
- behavior
-
-Explicitly removing the need for a proxy for specific remotes in the
-.gitconfig file via
-~~~
-[http <URL>]
- proxy =
-~~~
-results in an `error code 12: malformed URL ''` error. Expected
-behavior is to treat remotes for which such .gitconfig entries exist
-the same as if no proxy settings have been found at all.
-
-This issue was found in libgit2 v1.2.0.
-
-This commit fixes the issue.
----
- src/remote.c | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/src/remote.c b/src/remote.c
-index 7dddea93a..6021c27d4 100644
---- a/src/remote.c
-+++ b/src/remote.c
-@@ -887,6 +887,7 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
- git_config *cfg;
- git_buf buf = GIT_BUF_INIT;
- git_net_url lookup_url = GIT_NET_URL_INIT;
-+ char *tmp_out = NULL;
- int error;
-
- if ((error = git_net_url_dup(&lookup_url, url)) < 0 ||
-@@ -898,8 +899,14 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
- git_buf_clear(&buf);
-
- if ((error = git_buf_printf(&buf, "remote.%s.proxy", remote->name)) < 0 ||
-- (error = lookup_config(out, cfg, buf.ptr)) != GIT_ENOTFOUND)
-+ (error = lookup_config(&tmp_out, cfg, buf.ptr)) != GIT_ENOTFOUND) {
-+ /* only non-empty entries should be passed as proxy url */
-+ if (!tmp_out || strcmp(tmp_out, "")) {
-+ *out = git__strdup(tmp_out);
-+ GIT_ERROR_CHECK_ALLOC(*out);
-+ }
- goto done;
-+ }
- }
-
- while (true) {
-@@ -908,8 +915,14 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
- if ((error = git_buf_puts(&buf, "http.")) < 0 ||
- (error = git_net_url_fmt(&buf, &lookup_url)) < 0 ||
- (error = git_buf_puts(&buf, ".proxy")) < 0 ||
-- (error = lookup_config(out, cfg, buf.ptr)) != GIT_ENOTFOUND)
-+ (error = lookup_config(&tmp_out, cfg, buf.ptr)) != GIT_ENOTFOUND) {
-+ /* only non-empty entries should be passed as proxy url */
-+ if (!tmp_out || strcmp(tmp_out, "")) {
-+ *out = git__strdup(tmp_out);
-+ GIT_ERROR_CHECK_ALLOC(*out);
-+ }
- goto done;
-+ }
-
- if (! lookup_url.path[0])
- break;
-@@ -924,6 +937,7 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
- done:
- git_buf_dispose(&buf);
- git_net_url_dispose(&lookup_url);
-+ git__free(tmp_out);
- return error;
- }
-
---
-2.30.2
-
diff --git a/etc/patches/libgit2_v1.2.0_fix-fake-repo.patch b/etc/patches/libgit2_v1.5.0_fix-fake-repo.patch
index 22490c12..0da7c1bd 100644
--- a/etc/patches/libgit2_v1.2.0_fix-fake-repo.patch
+++ b/etc/patches/libgit2_v1.5.0_fix-fake-repo.patch
@@ -1,4 +1,4 @@
-From 1a4497d0aa05b48c40d939713a48bdf78dfa29e9 Mon Sep 17 00:00:00 2001
+From 19711a9a2a557f24df34ad16046f3daffaeab0e8 Mon Sep 17 00:00:00 2001
From: Oliver Reiche <oliver.reiche@huawei.com>
Date: Wed, 3 Aug 2022 16:27:58 +0200
Subject: [PATCH] Do not register fake repository as owner of ODB
@@ -13,14 +13,14 @@ used to create fake repositories in other threads.
Consequently, operations on fake repositories will interact
with the ODB's cache instead of the repository's cache.
---
- include/git2/sys/repository.h | 3 ++-
- src/repository.c | 16 +++++++++-------
- tests/odb/backend/nobackend.c | 2 +-
- tests/repo/setters.c | 23 ++++++++++++++++++++++-
+ include/git2/sys/repository.h | 3 ++-
+ src/libgit2/repository.c | 16 +++++++++-------
+ tests/libgit2/odb/backend/nobackend.c | 2 +-
+ tests/libgit2/repo/setters.c | 23 ++++++++++++++++++++++-
4 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/include/git2/sys/repository.h b/include/git2/sys/repository.h
-index 892be6692..33bc5051f 100644
+index 892be669266..33bc5051f31 100644
--- a/include/git2/sys/repository.h
+++ b/include/git2/sys/repository.h
@@ -97,9 +97,10 @@ GIT_EXTERN(int) git_repository_set_config(git_repository *repo, git_config *conf
@@ -32,17 +32,17 @@ index 892be6692..33bc5051f 100644
*/
-GIT_EXTERN(int) git_repository_set_odb(git_repository *repo, git_odb *odb);
+GIT_EXTERN(int) git_repository_set_odb(git_repository *repo, git_odb *odb, bool set_owner);
-
+
/**
* Set the Reference Database Backend for this repository
-diff --git a/src/repository.c b/src/repository.c
-index aae0c910b..13e1ca29e 100644
---- a/src/repository.c
-+++ b/src/repository.c
-@@ -86,10 +86,12 @@ git_buf git_repository__reserved_names_posix[] = {
+diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
+index df41f581c22..c31e5509edb 100644
+--- a/src/libgit2/repository.c
++++ b/src/libgit2/repository.c
+@@ -89,10 +89,12 @@ git_str git_repository__reserved_names_posix[] = {
};
size_t git_repository__reserved_names_posix_len = 1;
-
+
-static void set_odb(git_repository *repo, git_odb *odb)
+static void set_odb(git_repository *repo, git_odb *odb, bool set_owner)
{
@@ -53,70 +53,70 @@ index aae0c910b..13e1ca29e 100644
+ }
GIT_REFCOUNT_INC(odb);
}
-
-@@ -150,7 +152,7 @@ int git_repository__cleanup(git_repository *repo)
-
+
+@@ -153,7 +155,7 @@ int git_repository__cleanup(git_repository *repo)
+
set_config(repo, NULL);
set_index(repo, NULL);
- set_odb(repo, NULL);
+ set_odb(repo, NULL, /*set_owner=*/true);
set_refdb(repo, NULL);
-
+
return 0;
-@@ -762,7 +764,7 @@ static int _git_repository_open_ext_from_env(
+@@ -880,7 +882,7 @@ static int _git_repository_open_ext_from_env(
goto error;
-
+
if (odb)
- git_repository_set_odb(repo, odb);
+ git_repository_set_odb(repo, odb, /*set_owner=*/true);
-
+
error = git__getenv(&alts_buf, "GIT_ALTERNATE_OBJECT_DIRECTORIES");
if (error == GIT_ENOTFOUND) {
-@@ -973,7 +975,7 @@ int git_repository_wrap_odb(git_repository **repo_out, git_odb *odb)
+@@ -1098,7 +1100,7 @@ int git_repository_wrap_odb(git_repository **repo_out, git_odb *odb)
repo = repository_alloc();
GIT_ERROR_CHECK_ALLOC(repo);
-
+
- git_repository_set_odb(repo, odb);
+ git_repository_set_odb(repo, odb, /*set_owner=*/false);
*repo_out = repo;
-
+
return 0;
-@@ -1184,12 +1186,12 @@ int git_repository_odb(git_odb **out, git_repository *repo)
+@@ -1305,12 +1307,12 @@ int git_repository_odb(git_odb **out, git_repository *repo)
return 0;
}
-
+
-int git_repository_set_odb(git_repository *repo, git_odb *odb)
+int git_repository_set_odb(git_repository *repo, git_odb *odb, bool set_owner)
{
GIT_ASSERT_ARG(repo);
GIT_ASSERT_ARG(odb);
-
+
- set_odb(repo, odb);
+ set_odb(repo, odb, set_owner);
return 0;
}
-
-diff --git a/tests/odb/backend/nobackend.c b/tests/odb/backend/nobackend.c
-index 7484d423b..d46a7fed9 100644
---- a/tests/odb/backend/nobackend.c
-+++ b/tests/odb/backend/nobackend.c
-@@ -16,7 +16,7 @@ void test_odb_backend_nobackend__initialize(void)
+
+diff --git a/tests/libgit2/odb/backend/nobackend.c b/tests/libgit2/odb/backend/nobackend.c
+index 7d9394c6f33..4ba563223c4 100644
+--- a/tests/libgit2/odb/backend/nobackend.c
++++ b/tests/libgit2/odb/backend/nobackend.c
+@@ -17,7 +17,7 @@ void test_odb_backend_nobackend__initialize(void)
cl_git_pass(git_refdb_new(&refdb, _repo));
-
+
git_repository_set_config(_repo, config);
- git_repository_set_odb(_repo, odb);
+ git_repository_set_odb(_repo, odb, /*set_owner=*/true);
git_repository_set_refdb(_repo, refdb);
-
+
/* The set increases the refcount and we don't want them anymore */
-diff --git a/tests/repo/setters.c b/tests/repo/setters.c
-index 1fac627f6..e0e0d3696 100644
---- a/tests/repo/setters.c
-+++ b/tests/repo/setters.c
+diff --git a/tests/libgit2/repo/setters.c b/tests/libgit2/repo/setters.c
+index 66ec7706c2b..099a6fb3b3e 100644
+--- a/tests/libgit2/repo/setters.c
++++ b/tests/libgit2/repo/setters.c
@@ -94,7 +94,28 @@ void test_repo_setters__setting_a_new_odb_on_a_repo_which_already_loaded_one_pro
- cl_git_pass(git_odb_open(&new_odb, "./testrepo.git/objects"));
+ cl_git_pass(git_odb__open(&new_odb, "./testrepo.git/objects", NULL));
cl_assert(((git_refcount *)new_odb)->refcount.val == 1);
-
+
- git_repository_set_odb(repo, new_odb);
+ git_repository_set_odb(repo, new_odb, /*set_owner=*/true);
+ cl_assert(((git_refcount *)new_odb)->refcount.val == 2);
@@ -141,8 +141,5 @@ index 1fac627f6..e0e0d3696 100644
+
+ git_repository_set_odb(repo, new_odb, /*set_owner=*/false);
cl_assert(((git_refcount *)new_odb)->refcount.val == 2);
-
- git_repository_free(repo);
---
-2.30.2
+ git_repository_free(repo); \ No newline at end of file