UNBORN implies FAST_FORWARD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/include/git2/merge.h b/include/git2/merge.h
index 491f831..21159d8 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -248,8 +248,8 @@ typedef enum {
GIT_MERGE_ANALYSIS_NORMAL = (1 << 0),
/**
- * The repository is already up-to-date and no merge needs to be
- * performed. The given merge input already exists as a parent of HEAD.
+ * All given merge inputs are reachable from HEAD, meaning the
+ * repository is up-to-date and no merge needs to be performed.
*/
GIT_MERGE_ANALYSIS_UP_TO_DATE = (1 << 1),
diff --git a/src/merge.c b/src/merge.c
index 852043c..1be3515 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2531,7 +2531,7 @@ int git_merge_analysis(
*out = GIT_MERGE_ANALYSIS_NONE;
if (git_repository_head_unborn(repo)) {
- *out = GIT_MERGE_ANALYSIS_UNBORN;
+ *out = GIT_MERGE_ANALYSIS_FASTFORWARD | GIT_MERGE_ANALYSIS_UNBORN;
goto done;
}
diff --git a/tests/merge/workdir/analysis.c b/tests/merge/workdir/analysis.c
index 86b50b7..0e93785 100644
--- a/tests/merge/workdir/analysis.c
+++ b/tests/merge/workdir/analysis.c
@@ -99,7 +99,8 @@ void test_merge_workdir_analysis__unborn(void)
p_unlink(git_buf_cstr(&master));
analysis = analysis_from_branch(NOFASTFORWARD_BRANCH);
- cl_assert_equal_i(GIT_MERGE_ANALYSIS_UNBORN, analysis);
+ cl_assert_equal_i(GIT_MERGE_ANALYSIS_FASTFORWARD, (analysis & GIT_MERGE_ANALYSIS_FASTFORWARD));
+ cl_assert_equal_i(GIT_MERGE_ANALYSIS_UNBORN, (analysis & GIT_MERGE_ANALYSIS_UNBORN));
git_buf_free(&master);
}