path: root/commit.h
diff options
authorJunio C Hamano <>2008-06-27 16:22:03 (GMT)
committerJunio C Hamano <>2008-07-01 05:45:51 (GMT)
commit98cf9c3bd7504d36e6049939bf9cc624f2cf5b9f (patch)
tree1d74146b496f63ad16769356320c65e0bf5c2d6e /commit.h
parent6a938648e1454842157b84408acbb6471ec6745f (diff)
Introduce reduce_heads()
The new function reduce_heads() is given a list of commits, and removes ones that can be reached from other commits in the list. It is useful for reducing the commits randomly thrown at the git-merge command and remove redundant commits that the user shouldn't have given to it. The implementation uses the get_merge_bases_many() introduced in the previous commit. If the merge base between one commit taken from the list and the remaining commits is the commit itself, that means the commit is reachable from some of the other commits. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'commit.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index dcec7fb..2acfc79 100644
--- a/commit.h
+++ b/commit.h
@@ -140,4 +140,6 @@ static inline int single_parent(struct commit *commit)
return commit->parents && !commit->parents->next;
+struct commit_list *reduce_heads(struct commit_list *heads);
#endif /* COMMIT_H */