File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Collections ;
2
3
using System . Collections . Generic ;
3
4
using System . Linq ;
4
5
using LibGit2Sharp . Tests . TestHelpers ;
@@ -801,6 +802,26 @@ public void HandlesNameRewritingOfChainedTags()
801
802
Assert . Equal ( annotationB , backedUpTag . ResolveToDirectReference ( ) . Target ) ;
802
803
}
803
804
805
+ [ Fact ]
806
+ public void RewritingNotesHasNoEffect ( )
807
+ {
808
+ var notesRefsRetriever = new Func < IEnumerable < Reference > > ( ( ) => repo . Refs . Where ( r => r . CanonicalName . StartsWith ( "refs/notes/" ) ) ) ;
809
+ var originalNotesRefs = notesRefsRetriever ( ) . ToList ( ) ;
810
+ var commits = repo . Commits . QueryBy ( new CommitFilter { Since = originalNotesRefs } ) . ToArray ( ) ;
811
+
812
+ repo . Refs . RewriteHistory ( new RewriteHistoryOptions
813
+ {
814
+ OnError = OnError ,
815
+ OnSucceeding = OnSucceeding ,
816
+ CommitHeaderRewriter =
817
+ c => CommitRewriteInfo . From ( c , author : Constants . Signature ) ,
818
+ } , commits ) ;
819
+
820
+ AssertSucceedingButNotError ( ) ;
821
+
822
+ Assert . Equal ( originalNotesRefs . OrderBy ( r => r . CanonicalName ) , notesRefsRetriever ( ) . OrderBy ( r => r . CanonicalName ) ) ;
823
+ }
824
+
804
825
private static string TagNameRewriter ( string name , bool isAnnotated , string target )
805
826
{
806
827
const string tagPrefix = "refs/tags/" ;
Original file line number Diff line number Diff line change @@ -59,7 +59,11 @@ public void Execute()
59
59
// before A.
60
60
foreach ( var reference in refsToRewrite . OrderBy ( ReferenceDepth ) )
61
61
{
62
- // TODO: Check how rewriting of notes actually behaves
62
+ // TODO: Rewrite refs/notes/* properly
63
+ if ( reference . CanonicalName . StartsWith ( "refs/notes/" ) )
64
+ {
65
+ continue ;
66
+ }
63
67
64
68
RewriteReference ( reference ) ;
65
69
}
You can’t perform that action at this time.
0 commit comments