diff options
author | Edward Thomson <ethomson@microsoft.com> | 2014-06-18 18:05:09 +0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2014-06-18 21:33:41 +0400 |
commit | 6bfe4abeeb36fd96cdd1d539c75da4c7eabac43e (patch) | |
tree | b653536dc81317304bdb8164423d0e555fc571cb /LibGit2Sharp.Tests | |
parent | 413a892de43eac21394a0a7c58417c72f2246a78 (diff) |
Introduce merge.ff configuration handling
When the provided FastForwardStrategy is FastForwardStrategy.Default,
honor the merge.ff configuration setting. When merge.ff=only, enable
fast-forward only mode; when merge.ff=false, enable no-ff mode.
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/MergeFixture.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/MergeFixture.cs b/LibGit2Sharp.Tests/MergeFixture.cs index 2fcf9c64..dc0b8560 100644 --- a/LibGit2Sharp.Tests/MergeFixture.cs +++ b/LibGit2Sharp.Tests/MergeFixture.cs @@ -472,6 +472,19 @@ namespace LibGit2Sharp.Tests } [Fact] + public void CanForceFastForwardMergeThroughConfig() + { + string path = CloneMergeTestRepo(); + using (var repo = new Repository(path)) + { + repo.Config.Set("merge.ff", "only"); + + Commit commitToMerge = repo.Branches["normal_merge"].Tip; + Assert.Throws<NonFastForwardException>(() => repo.Merge(commitToMerge, Constants.Signature, new MergeOptions())); + } + } + + [Fact] public void CanMergeAndNotCommit() { string path = CloneMergeTestRepo(); @@ -509,6 +522,24 @@ namespace LibGit2Sharp.Tests } [Fact] + public void CanForceNonFastForwardMergeThroughConfig() + { + string path = CloneMergeTestRepo(); + using (var repo = new Repository(path)) + { + repo.Config.Set("merge.ff", "false"); + + Commit commitToMerge = repo.Branches["fast_forward"].Tip; + + MergeResult result = repo.Merge(commitToMerge, Constants.Signature, new MergeOptions()); + + Assert.Equal(MergeStatus.NonFastForward, result.Status); + Assert.Equal("f58f780d5a0ae392efd4a924450b1bbdc0577d32", result.Commit.Id.Sha); + Assert.False(repo.Index.RetrieveStatus().Any()); + } + } + + [Fact] public void VerifyUpToDateMerge() { string path = CloneMergeTestRepo(); |