]> granicus.if.org Git - cgit/commitdiff
git: update to v2.13.4
authorChristian Hesse <mail@eworm.de>
Mon, 24 Jul 2017 15:22:52 +0000 (17:22 +0200)
committerLukas Fleischer <lfleischer@lfos.de>
Thu, 10 Aug 2017 13:15:54 +0000 (15:15 +0200)
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.

Makefile
git
shared.c
ui-blob.c

index fe6cc982597f82a4f3c35196cd3f1950f87cb006..3d792ce25809d867d1b6ed47ff64c9c79e27cc73 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
 pdfdir = $(docdir)
 mandir = $(prefix)/share/man
 SHA1_HEADER = <openssl/sha.h>
-GIT_VER = 2.11.0
+GIT_VER = 2.13.4
 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
 INSTALL = install
 COPYTREE = cp -r
diff --git a/git b/git
index 454cb6bd52a4de614a3633e4f547af03d5c3b640..cf8899d285d2648013040ec7196ffd3de0606664 160000 (submodule)
--- a/git
+++ b/git
@@ -1 +1 @@
-Subproject commit 454cb6bd52a4de614a3633e4f547af03d5c3b640
+Subproject commit cf8899d285d2648013040ec7196ffd3de0606664
index c63f1e38a0dd92f1fbd6c671c04d3a8dab28ba2e..13a65a9ad9b1b2278e23deb738f421a9ccedfb4b 100644 (file)
--- 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)
index 5f30de753737290c1f3e3f4c6a4a861609d907a7..793817f0db8ced86dc1c091450f6a01f15e2aa40 100644 (file)
--- a/ui-blob.c
+++ b/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;
 }