Commit 3f2bb387 by Edward Thomson Committed by Edward Thomson

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.
parent b1eef912
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "common.h" #include "common.h"
#include "annotated_commit.h" #include "annotated_commit.h"
#include "refs.h"
#include "git2/commit.h" #include "git2/commit.h"
#include "git2/refs.h" #include "git2/refs.h"
...@@ -75,6 +76,26 @@ int git_annotated_commit_from_ref( ...@@ -75,6 +76,26 @@ int git_annotated_commit_from_ref(
return error; 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( int git_annotated_commit_lookup(
git_annotated_commit **out, git_annotated_commit **out,
git_repository *repo, git_repository *repo,
......
...@@ -19,4 +19,7 @@ struct git_annotated_commit { ...@@ -19,4 +19,7 @@ struct git_annotated_commit {
char id_str[GIT_OID_HEXSZ+1]; char id_str[GIT_OID_HEXSZ+1];
}; };
extern int git_annotated_commit_from_head(git_annotated_commit **out,
git_repository *repo);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment