Skip to content

Commit b264cf6

Browse files
committed
Tweaks
1 parent 08fafd5 commit b264cf6

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

LibGit2Sharp.Tests/WorktreeFixture.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using LibGit2Sharp.Tests.TestHelpers;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Linq;
5+
using LibGit2Sharp.Tests.TestHelpers;
66
using Xunit;
77

88
namespace 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,7 +288,6 @@ 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);
@@ -314,7 +312,6 @@ public void CanAddLockedWorktree_WithUncommitedChanges()
314312
Assert.Equal(3, repo.Worktrees.Count());
315313

316314
// 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)
318315
Assert.True(repo.RetrieveStatus().IsDirty);
319316
var filesInMain = GetFilesOfRepo(repoPath);
320317
var filesInBranch = GetFilesOfRepo(path);
@@ -351,7 +348,6 @@ public void CanAddLockedWorktree_WithCommitedChanges()
351348
Assert.Equal(3, repo.Worktrees.Count());
352349

353350
// 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)
355351
Assert.False(repo.RetrieveStatus().IsDirty);
356352
var filesInMain = GetFilesOfRepo(repoPath);
357353
var filesInBranch = GetFilesOfRepo(path);
@@ -380,7 +376,6 @@ public void CanAddWorktreeForCommittish()
380376
Assert.Equal(3, repo.Worktrees.Count());
381377

382378
// 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)
384379
var filesInCommittish = new string[] { "numbers.txt", "super-file.txt" };
385380
var filesInBranch = GetFilesOfRepo(path);
386381
Assert.Equal(filesInCommittish, filesInBranch);
@@ -390,9 +385,9 @@ public void CanAddWorktreeForCommittish()
390385
private static IEnumerable<string> GetFilesOfRepo(string repoPath)
391386
{
392387
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)
388+
.Where(fileName => !fileName.StartsWith($"{repoPath}\\.git"))
389+
.Select(fileName => fileName.Replace($"{repoPath}\\", ""))
390+
.OrderBy(fileName => fileName)
396391
.ToList();
397392
}
398393
}

LibGit2Sharp/WorktreeCollection.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public virtual Worktree this[string name]
4646
}
4747

4848
/// <summary>
49-
///
49+
/// Creates a worktree.
5050
/// </summary>
51-
/// <param name="committishOrBranchSpec">A committish or branch name./param>
51+
/// <param name="committishOrBranchSpec">The committish to checkout into the new worktree.</param>
5252
/// <param name="name">Name of the worktree.</param>
5353
/// <param name="path">Location of the worktree.</param>
5454
/// <param name="isLocked"></param>
@@ -84,11 +84,11 @@ public virtual Worktree Add(string committishOrBranchSpec, string name, string p
8484
}
8585

8686
/// <summary>
87-
///
87+
/// Creates a worktree.
8888
/// </summary>
89-
/// <param name="committishOrBranchSpec">A committish or branch name./param>
9089
/// <param name="name">Name of the worktree.</param>
9190
/// <param name="path">Location of the worktree.</param>
91+
/// <param name="isLocked"></param>
9292
public virtual Worktree Add(string name, string path, bool isLocked)
9393
{
9494
var options = new git_worktree_add_options

0 commit comments

Comments
 (0)