]> git.cameronkatri.com Git - cgit.git/blobdiff - shared.c
doc: use consistent id's when generating html files
[cgit.git] / shared.c
index c63f1e38a0dd92f1fbd6c671c04d3a8dab28ba2e..21ac8f4e68ea34b9ff0d95eb80612ed38404d21b 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_
 
        ref = xmalloc(sizeof (struct refinfo));
        ref->refname = xstrdup(refname);
-       ref->object = parse_object(oid->hash);
+       ref->object = parse_object(oid);
        switch (ref->object->type) {
        case OBJ_TAG:
                ref->tag = cgit_parse_tag((struct tag *)ref->object);
@@ -346,13 +346,13 @@ void cgit_diff_tree(const struct object_id *old_oid,
        opt.output_format = DIFF_FORMAT_CALLBACK;
        opt.detect_rename = 1;
        opt.rename_limit = ctx.cfg.renamelimit;
-       DIFF_OPT_SET(&opt, RECURSIVE);
+       opt.flags.recursive = 1;
        if (ignorews)
                DIFF_XDL_SET(&opt, IGNORE_WHITESPACE);
        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;
@@ -360,11 +360,13 @@ void cgit_diff_tree(const struct object_id *old_oid,
        diff_setup_done(&opt);
 
        if (old_oid && !is_null_oid(old_oid))
-               diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt);
+               diff_tree_oid(old_oid, new_oid, "", &opt);
        else
-               diff_root_tree_sha1(new_oid->hash, "", &opt);
+               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)