mirror of
https://git.freebsd.org/ports.git
synced 2025-07-08 21:09:17 -04:00
72 lines
2.1 KiB
Groff
72 lines
2.1 KiB
Groff
From af3025cf50642452a2000327bb8e845fd2191423 Mon Sep 17 00:00:00 2001
|
|
From: Christian Hesse <mail@eworm.de>
|
|
Date: Tue, 6 Jun 2017 17:16:32 +0200
|
|
Subject: git: update to v2.13.1
|
|
|
|
Update to git version v2.13.1: With commit 8aee769f (pathspec: copy and free
|
|
owned memory) the definition of struct pathspec_item has changed with the
|
|
expectation that pathspecs will be managed dynamically. We work around this
|
|
a bit by setting up a static structure, but let's allocate the match string
|
|
to avoid needing to cast away const.
|
|
|
|
Updated a patch from John Keeping <john@keeping.me.uk> for git v2.12.1.
|
|
---
|
|
git | 2 +-
|
|
shared.c | 4 +++-
|
|
ui-blob.c | 9 ++++++---
|
|
3 files changed, 10 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/shared.c b/shared.c
|
|
index c63f1e3..13a65a9 100644
|
|
--- shared.c
|
|
+++ shared.c
|
|
@@ -352,7 +352,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
|
|
opt.format_callback = cgit_diff_tree_cb;
|
|
opt.format_callback_data = fn;
|
|
if (prefix) {
|
|
- item.match = prefix;
|
|
+ item.match = xstrdup(prefix);
|
|
item.len = strlen(prefix);
|
|
opt.pathspec.nr = 1;
|
|
opt.pathspec.items = &item;
|
|
@@ -365,6 +365,8 @@ void cgit_diff_tree(const struct object_id *old_oid,
|
|
diff_root_tree_sha1(new_oid->hash, "", &opt);
|
|
diffcore_std(&opt);
|
|
diff_flush(&opt);
|
|
+
|
|
+ free(item.match);
|
|
}
|
|
|
|
void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
|
|
diff --git a/ui-blob.c b/ui-blob.c
|
|
index 5f30de7..793817f 100644
|
|
--- ui-blob.c
|
|
+++ ui-blob.c
|
|
@@ -38,7 +38,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
|
|
struct object_id oid;
|
|
unsigned long size;
|
|
struct pathspec_item path_items = {
|
|
- .match = path,
|
|
+ .match = xstrdup(path),
|
|
.len = strlen(path)
|
|
};
|
|
struct pathspec paths = {
|
|
@@ -53,10 +53,13 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
|
|
};
|
|
|
|
if (get_oid(ref, &oid))
|
|
- return 0;
|
|
+ goto done;
|
|
if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
|
|
- return 0;
|
|
+ goto done;
|
|
read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
|
|
+
|
|
+done:
|
|
+ free(path_items.match);
|
|
return walk_tree_ctx.found_path;
|
|
}
|
|
|
|
--
|
|
cgit v1.1-9-ge9c1d
|
|
|