]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-log.c
ui-snapshot: add support for zstd compression
[cgit.git] / ui-log.c
index 8e36fba9f811c13fb90ec9879f26bf3a4b33800e..dc5cb1eb6a0b34e7a0cc197cb397fc002248ee1e 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -65,7 +65,9 @@ void show_commit_decorations(struct commit *commit)
                return;
        html("<span class='decoration'>");
        while (deco) {
-               strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1);
+               struct object_id peeled;
+               int is_annotated = 0;
+               strlcpy(buf, prettify_refname(deco->name), sizeof(buf));
                switch(deco->type) {
                case DECORATION_NONE:
                        /* If the git-core doesn't recognize it,
@@ -77,7 +79,9 @@ void show_commit_decorations(struct commit *commit)
                                ctx.qry.showmsg, 0);
                        break;
                case DECORATION_REF_TAG:
-                       cgit_tag_link(buf, NULL, "tag-deco", buf);
+                       if (!peel_ref(deco->name, &peeled))
+                               is_annotated = !oidcmp(&commit->object.oid, &peeled);
+                       cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf);
                        break;
                case DECORATION_REF_REMOTE:
                        if (!ctx.repo->enable_remote_branches)
@@ -149,8 +153,8 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
        rem_lines = 0;
 
        revs->diffopt.flags.recursive = 1;
-       diff_tree_oid(&parent->tree->object.oid,
-                     &commit->tree->object.oid,
+       diff_tree_oid(&parent->maybe_tree->object.oid,
+                     &commit->maybe_tree->object.oid,
                      "", &revs->diffopt);
        diffcore_std(&revs->diffopt);
 
@@ -230,7 +234,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
                        strbuf_add(&msgbuf, "\n\n", 2);
 
                        /* Place wrap_symbol at position i in info->subject */
-                       strcpy(info->subject + i, wrap_symbol);
+                       strlcpy(info->subject + i, wrap_symbol, subject_len - i + 1);
                }
        }
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
@@ -358,7 +362,7 @@ static char *next_token(char **src)
 }
 
 void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
-                   char *path, int pager, int commit_graph, int commit_sort)
+                   const char *path, int pager, int commit_graph, int commit_sort)
 {
        struct rev_info rev;
        struct commit *commit;
@@ -484,7 +488,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
        for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; /* nop */) {
                if (show_commit(commit, &rev))
                        i++;
-               free_commit_buffer(commit);
+               free_commit_buffer(the_repository->parsed_objects, commit);
                free_commit_list(commit->parents);
                commit->parents = NULL;
        }
@@ -506,7 +510,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
                        i++;
                        print_commit(commit, &rev);
                }
-               free_commit_buffer(commit);
+               free_commit_buffer(the_repository->parsed_objects, commit);
                free_commit_list(commit->parents);
                commit->parents = NULL;
        }