From 3f2bb387a43185991d7e077fa5e6c0bb467f2abc Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 28 Oct 2015 11:00:55 -0400 Subject: merge: octopus merge common ancestors when >2 When there are more than two common ancestors, continue merging the virtual base with the additional common ancestors, effectively octopus merging a new virtual base. --- src/annotated_commit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/annotated_commit.c') diff --git a/src/annotated_commit.c b/src/annotated_commit.c index 3f2d2ed17..036e601c1 100644 --- a/src/annotated_commit.c +++ b/src/annotated_commit.c @@ -7,6 +7,7 @@ #include "common.h" #include "annotated_commit.h" +#include "refs.h" #include "git2/commit.h" #include "git2/refs.h" @@ -75,6 +76,26 @@ int git_annotated_commit_from_ref( return error; } +int git_annotated_commit_from_head( + git_annotated_commit **out, + git_repository *repo) +{ + git_reference *head; + int error; + + assert(out && repo); + + *out = NULL; + + if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0) + return -1; + + error = git_annotated_commit_from_ref(out, repo, head); + + git_reference_free(head); + return error; +} + int git_annotated_commit_lookup( git_annotated_commit **out, git_repository *repo, -- cgit v1.2.1