Commit 0276f0f5 by Juan Rubén

Reset num_parents to 1 only for merge commits

Also, correct test case to account for the boundary flag
parent 899bd19a
......@@ -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;
......
......@@ -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");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment