]> gitweb.ps.run Git - ps-cgit/blobdiff - shared.c
git: update to v2.39.1
[ps-cgit] / shared.c
index a2c0d038165cd87f09329fc75117183bfca86d24..0bceb98912280ac50f8f58dc9219e006e165e280 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -58,6 +58,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
        ret->homepage = NULL;
        ret->section = ctx.cfg.section;
        ret->snapshots = ctx.cfg.snapshots;
+       ret->enable_blame = ctx.cfg.enable_blame;
        ret->enable_commit_graph = ctx.cfg.enable_commit_graph;
        ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
        ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
@@ -340,9 +341,8 @@ void cgit_diff_tree(const struct object_id *old_oid,
                    filepair_fn fn, const char *prefix, int ignorews)
 {
        struct diff_options opt;
-       struct pathspec_item item;
+       struct pathspec_item *item;
 
-       memset(&item, 0, sizeof(item));
        diff_setup(&opt);
        opt.output_format = DIFF_FORMAT_CALLBACK;
        opt.detect_rename = 1;
@@ -353,10 +353,11 @@ 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 = xstrdup(prefix);
-               item.len = strlen(prefix);
+               item = xcalloc(1, sizeof(*item));
+               item->match = xstrdup(prefix);
+               item->len = strlen(prefix);
                opt.pathspec.nr = 1;
-               opt.pathspec.items = &item;
+               opt.pathspec.items = item;
        }
        diff_setup_done(&opt);
 
@@ -366,8 +367,6 @@ void cgit_diff_tree(const struct object_id *old_oid,
                diff_root_tree_oid(new_oid, "", &opt);
        diffcore_std(&opt);
        diff_flush(&opt);
-
-       free(item.match);
 }
 
 void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)