]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit-graph.c
gitweb: correctly store previous rev in javascript-actions mode
[thirdparty/git.git] / commit-graph.c
index b3c4de79b6da4502726dbec5e21b11734d76e28e..fe954ab5f845e65bc5cad987308aeb6598f2fd24 100644 (file)
@@ -434,6 +434,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const
 
        free(oids);
        fclose(fp);
+       strbuf_release(&line);
 
        return graph_chain;
 }
@@ -1186,7 +1187,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
        }
 
        stop_progress(&ctx->progress);
-       strbuf_reset(&progress_title);
+       strbuf_release(&progress_title);
        strbuf_release(&packname);
 
        return 0;
@@ -1636,7 +1637,7 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx)
                                num_parents++;
 
                        if (num_parents > 2)
-                               ctx->num_extra_edges += num_parents - 2;
+                               ctx->num_extra_edges += num_parents - 1;
                }
        }
 
@@ -1713,10 +1714,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
        strbuf_addstr(&path, "/info/commit-graphs");
        dir = opendir(path.buf);
 
-       if (!dir) {
-               strbuf_release(&path);
-               return;
-       }
+       if (!dir)
+               goto out;
 
        strbuf_addch(&path, '/');
        dirnamelen = path.len;
@@ -1745,6 +1744,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
                if (!found)
                        unlink(path.buf);
        }
+
+out:
+       strbuf_release(&path);
 }
 
 int write_commit_graph(const char *obj_dir,