Skip to content
Browse files

Add RepositoryStatus.Ignored

Closes #120
  • Loading branch information...
1 parent e32f933 commit 842e30fcf6922431252f71ddf53504384917ac91 @dahlbyk dahlbyk committed Mar 5, 2012
Showing with 11 additions and 0 deletions.
  1. +1 −0 LibGit2Sharp.Tests/StatusFixture.cs
  2. +10 −0 LibGit2Sharp/RepositoryStatus.cs
View
1 LibGit2Sharp.Tests/StatusFixture.cs
@@ -148,6 +148,7 @@ public void RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectives()
newStatus.Untracked.Single().ShouldEqual(".gitignore");
repo.Index.RetrieveStatus(relativePath).ShouldEqual(FileStatus.Ignored);
+ Assert.Equal(new[] { relativePath, "new_untracked_file.txt" }, newStatus.Ignored);
}
}
}
View
10 LibGit2Sharp/RepositoryStatus.cs
@@ -18,6 +18,7 @@ public class RepositoryStatus : IEnumerable<StatusEntry>
private readonly List<string> missing = new List<string>();
private readonly List<string> modified = new List<string>();
private readonly List<string> untracked = new List<string>();
+ private readonly List<string> ignored = new List<string>();
private readonly bool isDirty;
private readonly IDictionary<FileStatus, Action<RepositoryStatus, string>> dispatcher = Build();
@@ -32,6 +33,7 @@ public class RepositoryStatus : IEnumerable<StatusEntry>
{ FileStatus.Added, (rs, s) => rs.added.Add(s) },
{ FileStatus.Staged, (rs, s) => rs.staged.Add(s) },
{ FileStatus.Removed, (rs, s) => rs.removed.Add(s) },
+ { FileStatus.Ignored, (rs, s) => rs.ignored.Add(s) },
};
}
@@ -128,6 +130,14 @@ public IEnumerable<string> Untracked
}
/// <summary>
+ /// List of files existing in the working directory that are ignored.
+ /// </summary>
+ public IEnumerable<string> Ignored
+ {
+ get { return ignored; }
+ }
+
+ /// <summary>
/// True if the index or the working directory has been altered since the last commit. False otherwise.
/// </summary>
public bool IsDirty

0 comments on commit 842e30f

Please sign in to comment.
Something went wrong with that request. Please try again.