libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

NormalMerge should call callback on conflicts

Open idealist1508 opened this issue 4 years ago • 0 comments

Reproduction steps

        [Fact]
        public void NormalMergeShouldCallCallbackOnConflicts()
        {
            string committishToMerge = "fast_forward";

            using (var repo = new Repository(SandboxMergeTestRepo()))
            {
                Touch(repo.Info.WorkingDirectory, "b.txt", "this is an alternate change");
                var conflicts = 0;
                var options = new MergeOptions
                {
                    OnCheckoutNotify = (path, flags) =>
                {
                    conflicts++;
                    return true;
                },
                CheckoutNotifyFlags = CheckoutNotifyFlags.Conflict,
                FastForwardStrategy = FastForwardStrategy.NoFastForward,
            };

                Assert.Throws<CheckoutConflictException>(() => repo.Merge(committishToMerge, Constants.Signature, options));
                Assert.Equal(1, conflicts) ;
            }
        }

Expected behavior

Test shouldn't fail

Actual behavior

Test fails

Version of LibGit2Sharp (release number or SHA1)

df3b22a754ef56da8d7e3c330ce2d783c2b7982e

Operating system(s) tested; .NET runtime tested

Windows netcore 2.1

idealist1508 avatar Mar 18 '21 23:03 idealist1508