1- using LibGit2Sharp . Tests . TestHelpers ;
2- using System ;
1+ using System ;
32using System . Collections . Generic ;
43using System . IO ;
54using System . Linq ;
5+ using LibGit2Sharp . Tests . TestHelpers ;
66using Xunit ;
77
88namespace LibGit2Sharp . Tests
@@ -252,7 +252,6 @@ public void CanAddWorktree_WithUncommitedChanges()
252252 Assert . Equal ( 3 , repo . Worktrees . Count ( ) ) ;
253253
254254 // Check that branch contains same number of files and folders
255- // NOTE: There is an open bug - [Repository.Worktrees.Add leaves now worktree empty](https://github.com/libgit2/libgit2sharp/issues/2037)
256255 Assert . True ( repo . RetrieveStatus ( ) . IsDirty ) ;
257256 var filesInMain = GetFilesOfRepo ( repoPath ) ;
258257 var filesInBranch = GetFilesOfRepo ( path ) ;
@@ -289,10 +288,10 @@ public void CanAddWorktree_WithCommitedChanges()
289288 Assert . Equal ( 3 , repo . Worktrees . Count ( ) ) ;
290289
291290 // Check that branch contains same number of files and folders
292- // NOTE: There is an open bug - [Repository.Worktrees.Add leaves now worktree empty](https://github.com/libgit2/libgit2sharp/issues/2037)
293291 Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
294292 var filesInMain = GetFilesOfRepo ( repoPath ) ;
295293 var filesInBranch = GetFilesOfRepo ( path ) ;
294+
296295 Assert . Equal ( filesInMain , filesInBranch ) ;
297296 }
298297 }
@@ -314,7 +313,6 @@ public void CanAddLockedWorktree_WithUncommitedChanges()
314313 Assert . Equal ( 3 , repo . Worktrees . Count ( ) ) ;
315314
316315 // Check that branch contains same number of files and folders
317- // NOTE: There is an open bug - [Repository.Worktrees.Add leaves now worktree empty](https://github.com/libgit2/libgit2sharp/issues/2037)
318316 Assert . True ( repo . RetrieveStatus ( ) . IsDirty ) ;
319317 var filesInMain = GetFilesOfRepo ( repoPath ) ;
320318 var filesInBranch = GetFilesOfRepo ( path ) ;
@@ -351,7 +349,6 @@ public void CanAddLockedWorktree_WithCommitedChanges()
351349 Assert . Equal ( 3 , repo . Worktrees . Count ( ) ) ;
352350
353351 // Check that branch contains same number of files and folders
354- // NOTE: There is an open bug - [Repository.Worktrees.Add leaves now worktree empty](https://github.com/libgit2/libgit2sharp/issues/2037)
355352 Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
356353 var filesInMain = GetFilesOfRepo ( repoPath ) ;
357354 var filesInBranch = GetFilesOfRepo ( path ) ;
@@ -380,7 +377,6 @@ public void CanAddWorktreeForCommittish()
380377 Assert . Equal ( 3 , repo . Worktrees . Count ( ) ) ;
381378
382379 // Check that branch contains same number of files and folders
383- // NOTE: There is an open bug - [Repository.Worktrees.Add leaves now worktree empty](https://github.com/libgit2/libgit2sharp/issues/2037)
384380 var filesInCommittish = new string [ ] { "numbers.txt" , "super-file.txt" } ;
385381 var filesInBranch = GetFilesOfRepo ( path ) ;
386382 Assert . Equal ( filesInCommittish , filesInBranch ) ;
@@ -390,9 +386,9 @@ public void CanAddWorktreeForCommittish()
390386 private static IEnumerable < string > GetFilesOfRepo ( string repoPath )
391387 {
392388 return Directory . GetFiles ( repoPath , "*" , SearchOption . AllDirectories )
393- . Where ( fileName => ! fileName . StartsWith ( $ " { repoPath } \\ .git" , StringComparison . InvariantCultureIgnoreCase ) )
394- . Select ( fileName => fileName . Replace ( $ "{ repoPath } \\ ", "" , StringComparison . InvariantCultureIgnoreCase ) )
395- . OrderBy ( fileName => fileName , StringComparer . InvariantCultureIgnoreCase )
389+ . Where ( fileName => ! fileName . StartsWith ( Path . Combine ( repoPath , ".git" ) ) )
390+ . Select ( fileName => fileName . Replace ( $ "{ repoPath } { Path . DirectorySeparatorChar } ", "" ) )
391+ . OrderBy ( fileName => fileName )
396392 . ToList ( ) ;
397393 }
398394 }
0 commit comments