summaryrefslogtreecommitdiff
path: root/shared.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2017-07-24 17:22:52 +0200
committerLukas Fleischer <lfleischer@lfos.de>2017-08-10 15:15:54 +0200
commit3d33b46df24d4dee140d0aafb1eba5fffa314cf0 (patch)
tree86086c5ca8dfe17322ced822e7c313fd09337824 /shared.c
parent7ce19ba550ff0d32359b9fb35eeb6282747524b9 (diff)
git: update to v2.13.4
Update to git version v2.13.4: 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.
Diffstat (limited to 'shared.c')
-rw-r--r--shared.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shared.c b/shared.c
index c63f1e3..13a65a9 100644
--- a/shared.c
+++ b/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)