diff --git a/gj_common/gitjournal.c b/gj_common/gitjournal.c index fbc83c82..47ea649f 100644 --- a/gj_common/gitjournal.c +++ b/gj_common/gitjournal.c @@ -474,11 +474,8 @@ int gj_git_pull(const char *git_base_path, const char *author_name, const char * if (err < 0) goto cleanup; - git_merge_options merge_options = GIT_MERGE_OPTIONS_INIT; - git_checkout_options checkout_options = GIT_CHECKOUT_OPTIONS_INIT; - - // FIXME: Maybe I should be taking the head of the remote? - err = git_repository_head(&ref, repo); + // FIXME: Do not hardcode the master branch! + err = git_reference_lookup(&ref, repo, "refs/remotes/origin/master"); if (err < 0) goto cleanup; @@ -486,6 +483,9 @@ int gj_git_pull(const char *git_base_path, const char *author_name, const char * if (err < 0) goto cleanup; + git_merge_options merge_options = GIT_MERGE_OPTIONS_INIT; + git_checkout_options checkout_options = GIT_CHECKOUT_OPTIONS_INIT; + err = git_merge(repo, (const git_annotated_commit **)&annotated_commit, 1, &merge_options, &checkout_options); if (err < 0) @@ -552,9 +552,6 @@ int gj_git_pull(const char *git_base_path, const char *author_name, const char * if (err < 0) goto cleanup; - printf("Looked up origin head commit\n"); - printf("About to commit\n"); - const git_commit *parents[] = {head_commit, origin_head_commit}; char *message = "Custom Merge commit"; git_oid commit_id;