diff --git a/src/blame_git.c b/src/blame_git.c index c275293c3..72afb852b 100644 --- a/src/blame_git.c +++ b/src/blame_git.c @@ -489,7 +489,7 @@ static void pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt if (!git_oid_cmp(git_commit_id(commit), &blame->options.oldest_commit)) /* Stop at oldest specified commit */ num_parents = 0; - else if (opt & GIT_BLAME_FIRST_PARENT) + else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1) /* Limit search to the first parent */ num_parents = 1; diff --git a/tests/blame/simple.c b/tests/blame/simple.c index 18b3457af..11ff4cd19 100644 --- a/tests/blame/simple.c +++ b/tests/blame/simple.c @@ -314,7 +314,7 @@ void test_blame_simple__can_restrict_to_first_parent_commits(void) cl_git_pass(git_blame_file(&g_blame, g_repo, "b.txt", &opts)); cl_assert_equal_i(4, git_blame_get_hunk_count(g_blame)); check_blame_hunk_index(g_repo, g_blame, 0, 1, 4, 0, "da237394", "b.txt"); - check_blame_hunk_index(g_repo, g_blame, 1, 5, 1, 0, "b99f7ac0", "b.txt"); + check_blame_hunk_index(g_repo, g_blame, 1, 5, 1, 1, "b99f7ac0", "b.txt"); check_blame_hunk_index(g_repo, g_blame, 2, 6, 5, 0, "63d671eb", "b.txt"); check_blame_hunk_index(g_repo, g_blame, 3, 11, 5, 0, "bc7c5ac2", "b.txt"); }