diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2014-03-18 16:04:51 -0700 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2014-03-20 09:25:11 -0700 |
| commit | ac584fcfd3e15b0a0200ee609bf964414936c710 (patch) | |
| tree | 5248a253050c1b65f1de2cd9851e00ca8a0dd1ca /tests/merge | |
| parent | 97f3462ae699fae370cfa410ed58eb869ae6b276 (diff) | |
| download | libgit2-ac584fcfd3e15b0a0200ee609bf964414936c710.tar.gz | |
Introduce GIT_MERGE_ANALYSIS_UNBORN
Diffstat (limited to 'tests/merge')
| -rw-r--r-- | tests/merge/workdir/analysis.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/merge/workdir/analysis.c b/tests/merge/workdir/analysis.c index 6a4b86d26..86b50b718 100644 --- a/tests/merge/workdir/analysis.c +++ b/tests/merge/workdir/analysis.c @@ -5,6 +5,7 @@ #include "merge.h" #include "../merge_helpers.h" #include "refs.h" +#include "posix.h" static git_repository *repo; static git_index *repo_index; @@ -39,18 +40,18 @@ static git_merge_analysis_t analysis_from_branch(const char *branchname) { git_buf refname = GIT_BUF_INIT; git_reference *their_ref; - git_merge_head *their_heads[1]; + git_merge_head *their_head; git_merge_analysis_t analysis; git_buf_printf(&refname, "%s%s", GIT_REFS_HEADS_DIR, branchname); cl_git_pass(git_reference_lookup(&their_ref, repo, git_buf_cstr(&refname))); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, their_ref)); + cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); - cl_git_pass(git_merge_analysis(&analysis, repo, their_heads, 1)); + cl_git_pass(git_merge_analysis(&analysis, repo, (const git_merge_head **)&their_head, 1)); git_buf_free(&refname); - git_merge_head_free(their_heads[0]); + git_merge_head_free(their_head); git_reference_free(their_ref); return analysis; @@ -88,3 +89,18 @@ void test_merge_workdir_analysis__uptodate_merging_prev_commit(void) analysis = analysis_from_branch(PREVIOUS_BRANCH); cl_assert_equal_i(GIT_MERGE_ANALYSIS_UP_TO_DATE, analysis); } + +void test_merge_workdir_analysis__unborn(void) +{ + git_merge_analysis_t analysis; + git_buf master = GIT_BUF_INIT; + + git_buf_joinpath(&master, git_repository_path(repo), "refs/heads/master"); + p_unlink(git_buf_cstr(&master)); + + analysis = analysis_from_branch(NOFASTFORWARD_BRANCH); + cl_assert_equal_i(GIT_MERGE_ANALYSIS_UNBORN, analysis); + + git_buf_free(&master); +} + |
