Commit 9a8126e0 by Jacques Germishuys Committed by The rugged tests are fragile

Only check for workdir conflicts if the index has merged files

Passing 0 as the length of the paths to check to git_diff_index_to_workdir
results in all files being treated as conflicting, that is, all untracked or
modified files in the worktree is reported as conflicting
parent edb2b835
...@@ -2351,6 +2351,16 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde ...@@ -2351,6 +2351,16 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde
*conflicts = 0; *conflicts = 0;
/* We need to have merged at least 1 file for the possibility to exist to
* have conflicts with the workdir. Passing 0 as the pathspec count paramter
* will consider all files in the working directory, that is, we may detect
* a conflict if there were untracked files in the workdir prior to starting
* the merge. This typically happens when cherry-picking a commmit whose
* changes have already been applied.
*/
if (merged_paths->length == 0)
return 0;
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED; opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED;
/* Workdir changes may exist iff they do not conflict with changes that /* Workdir changes may exist iff they do not conflict with changes that
......
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