summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-27 10:57:02 +0900
committerJunio C Hamano <gitster@pobox.com>2017-11-27 10:57:02 +0900
commit80a0e0fdd6b51744a7c76583874e2993df645e47 (patch)
tree3ca2a1e5a94ab89c59d7f3084c7339cd23dd312a /commit.h
parent03e8004f0674a704330519d07fa84957989e2686 (diff)
parent4da72644b768b0491110a8ba0aa84d32b6bde41c (diff)
downloadgit-80a0e0fdd6b51744a7c76583874e2993df645e47.tar.gz
Merge branch 'ma/reduce-heads-leakfix' into maint
Leak fixes. * ma/reduce-heads-leakfix: reduce_heads: fix memory leaks builtin/merge-base: free commit lists
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/commit.h b/commit.h
index 6d769590f2..99a3fea68d 100644
--- a/commit.h
+++ b/commit.h
@@ -313,7 +313,23 @@ extern int interactive_add(int argc, const char **argv, const char *prefix, int
extern int run_add_interactive(const char *revision, const char *patch_mode,
const struct pathspec *pathspec);
-struct commit_list *reduce_heads(struct commit_list *heads);
+/*
+ * Takes a list of commits and returns a new list where those
+ * have been removed that can be reached from other commits in
+ * the list. It is useful for, e.g., reducing the commits
+ * randomly thrown at the git-merge command and removing
+ * redundant commits that the user shouldn't have given to it.
+ *
+ * This function destroys the STALE bit of the commit objects'
+ * flags.
+ */
+extern struct commit_list *reduce_heads(struct commit_list *heads);
+
+/*
+ * Like `reduce_heads()`, except it replaces the list. Use this
+ * instead of `foo = reduce_heads(foo);` to avoid memory leaks.
+ */
+extern void reduce_heads_replace(struct commit_list **heads);
struct commit_extra_header {
struct commit_extra_header *next;