diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-10-28 11:00:55 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-11-25 15:37:57 -0500 |
commit | 3f2bb387a43185991d7e077fa5e6c0bb467f2abc (patch) | |
tree | 3e95f14ff4923d2469cf3bf6f9de34504eaefe4e /src/annotated_commit.c | |
parent | b1eef912cffb9e3ce9792b6aee816c1a45c85fb0 (diff) | |
download | libgit2-3f2bb387a43185991d7e077fa5e6c0bb467f2abc.tar.gz |
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.
Diffstat (limited to 'src/annotated_commit.c')
-rw-r--r-- | src/annotated_commit.c | 21 |
1 files changed, 21 insertions, 0 deletions
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, |