8000 Add test for add/removing ignore entries · rlazev/libgit2sharp@e828545 · GitHub
[go: up one dir, main page]

Skip to content

Commit e828545

Browse files
committed
Add test for add/removing ignore entries
1 parent da682b3 commit e828545

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

LibGit2Sharp.Tests/IgnoreFixture.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using LibGit2Sharp.Tests.TestHelpers;
7+
using Xunit;
8+
9+
namespace LibGit2Sharp.Tests
10+
{
11+
public class IgnoreFixture : BaseFixture
12+
{
13+
[Fact]
14+
public void TemporaryRulesShouldApplyUntilCleared()
15+
{
16+
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoWorkingDirPath);
17+
using (var repo = new Repository(path.RepositoryPath))
18+
{
19+
File.WriteAllText(Path.Combine(repo.Info.WorkingDirectory, "Foo.cs"), "Bar");
20+
21+
Assert.True(repo.Index.RetrieveStatus().Untracked.Contains("Foo.cs"));
22+
23+
repo.Ignore.AddTemporaryRules(new[] { "*.cs" });
24+
25+
Assert.False(repo.Index.RetrieveStatus().Untracked.Contains("Foo.cs"));
26+
27+
repo.Ignore.ResetAllTemporaryRules();
28+
29+
Assert.True(repo.Index.RetrieveStatus().Untracked.Contains("Foo.cs"));
30+
}
31+
}
32+
33+
[Fact]
34+
public void IsPathIgnoredShouldVerifyWhetherPathIsIgnored()
35+
{
36+
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoWorkingDirPath);
37+
using (var repo = new Repository(path.RepositoryPath))
38+
{
39+
40+
}
41+
}
42+
}
43+
}

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<ItemGroup>
6060
<Compile Include="CheckoutFixture.cs" />
6161
<Compile Include="CloneFixture.cs" />
62+
<Compile Include="IgnoreFixture.cs" />
6263
<Compile Include="MergeFixture.cs" />
6364
<Compile Include="CleanFixture.cs" />
6465
<Compile Include="CurrentOperationFixture.cs" />

LibGit2Sharp/Repository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public Ignore Ignore
195195
{
196196
get
197197
{
198-
return Ignore;
198+
return ignore;
199199
}
200200
}
201201

0 commit comments

Comments
 (0)
0