mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
examples: move refish resolution function in common
This commit is contained in:
@@ -87,29 +87,6 @@ static void parse_options(const char **repo_path, merge_options *opts, int argc,
|
||||
}
|
||||
}
|
||||
|
||||
static int resolve_refish(git_annotated_commit **commit, git_repository *repo, const char *refish)
|
||||
{
|
||||
git_reference *ref;
|
||||
int err = 0;
|
||||
git_oid oid;
|
||||
|
||||
assert(commit != NULL);
|
||||
|
||||
err = git_reference_dwim(&ref, repo, refish);
|
||||
if (err == GIT_OK) {
|
||||
git_annotated_commit_from_ref(commit, repo, ref);
|
||||
git_reference_free(ref);
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = git_oid_fromstr(&oid, refish);
|
||||
if (err == GIT_OK) {
|
||||
err = git_annotated_commit_lookup(commit, repo, &oid);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int resolve_heads(git_repository *repo, merge_options *opts)
|
||||
{
|
||||
git_annotated_commit **annotated = calloc(opts->heads_count, sizeof(git_annotated_commit *));
|
||||
|
||||
Reference in New Issue
Block a user