Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'LibGit2Sharp.Tests/FilterBranchFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/FilterBranchFixture.cs23
1 files changed, 22 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/FilterBranchFixture.cs b/LibGit2Sharp.Tests/FilterBranchFixture.cs
index dfe14329..aed628a1 100644
--- a/LibGit2Sharp.Tests/FilterBranchFixture.cs
+++ b/LibGit2Sharp.Tests/FilterBranchFixture.cs
@@ -162,7 +162,8 @@ namespace LibGit2Sharp.Tests
AssertSucceedingButNotError();
- var nonBackedUpRefs = repo.Refs.Where(x => !x.CanonicalName.StartsWith("refs/original"));
+ var nonBackedUpRefs = repo.Refs.Where(
+ x => !x.CanonicalName.StartsWith("refs/original/") && !x.CanonicalName.StartsWith("refs/notes/"));
Assert.Empty(repo.Commits.QueryBy(new CommitFilter { Since = nonBackedUpRefs })
.Where(c => c.Author.Name != "Ben Straub"));
}
@@ -801,6 +802,26 @@ namespace LibGit2Sharp.Tests
Assert.Equal(annotationB, backedUpTag.ResolveToDirectReference().Target);
}
+ [Fact]
+ public void RewritingNotesHasNoEffect()
+ {
+ var notesRefsRetriever = new Func<IEnumerable<Reference>>(() => repo.Refs.Where(r => r.CanonicalName.StartsWith("refs/notes/")));
+ var originalNotesRefs = notesRefsRetriever().ToList();
+ var commits = repo.Commits.QueryBy(new CommitFilter { Since = originalNotesRefs }).ToArray();
+
+ repo.Refs.RewriteHistory(new RewriteHistoryOptions
+ {
+ OnError = OnError,
+ OnSucceeding = OnSucceeding,
+ CommitHeaderRewriter =
+ c => CommitRewriteInfo.From(c, author: Constants.Signature),
+ }, commits);
+
+ AssertSucceedingButNotError();
+
+ Assert.Equal(originalNotesRefs.OrderBy(r => r.CanonicalName), notesRefsRetriever().OrderBy(r => r.CanonicalName));
+ }
+
private static string TagNameRewriter(string name, bool isAnnotated, string target)
{
const string tagPrefix = "refs/tags/";