Skip to content

Commit

Permalink
Merge pull request #1079 from doug24/1076-git-dir
Browse files Browse the repository at this point in the history
#1076 - gitignore
  • Loading branch information
doug24 committed Mar 15, 2024
2 parents 9c914eb + eb19d4f commit d9aa0ac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dnGREP.Common/GitUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ public Gitignore()

public Gitignore(string path, List<string> list)
{
// add .git to the directories to ignore
string git = Path.Combine(path, ".git");
if (Directory.Exists(git))
{
directories.Add(git);
}
// add .gitignore to the files to ignore
string gitignore = Path.Combine(path, ".gitignore");
if (File.Exists(gitignore))
{
files.Add(gitignore);
}

foreach (var item in list.Where(s => !s.StartsWith("..", StringComparison.OrdinalIgnoreCase) &&
s.EndsWith(gitSeparator, StringComparison.CurrentCulture))
.Select(s => Path.Combine(path, s.Replace(gitSeparatorChar, Path.DirectorySeparatorChar)
Expand Down

0 comments on commit d9aa0ac

Please sign in to comment.