Skip to content

Commit

Permalink
Ignore all Git configuration files and directories
Browse files Browse the repository at this point in the history
Suggested by Amitai Schleier via private mail.
  • Loading branch information
rillig committed Jul 17, 2024
1 parent f4097f1 commit 71b863a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
16 changes: 13 additions & 3 deletions v23/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,22 @@ func getSubdirs(filename CurrPath) []RelPath {

func isIgnoredFilename(filename string) bool {
switch filename {
case "CVS", ".svn", ".git", ".hg", ".idea":
case "CVS", ".svn", ".hg", ".idea":
return true
}
switch {

case hasPrefix(filename, ".#"):
// https://www.gnu.org/software/trans-coord/manual/cvs/cvs.html#cvsignore
return true
case hasPrefix(filename, ".git"):
return true
case hasSuffix(filename, "~"):
return true
}

return false

// https://www.gnu.org/software/trans-coord/manual/cvs/cvs.html#cvsignore
return hasPrefix(filename, ".#") || hasSuffix(filename, "~")
}

// Checks whether a file is already committed to the CVS repository.
Expand Down
5 changes: 3 additions & 2 deletions v23/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ func (s *Suite) Test_isIgnoredFilename(c *check.C) {
}

test("filename.mk", false)
test(".gitignore", false)
test(".github", true)
test(".gitignore", true)
test(".git", true)
test(".gitattributes", false)
test(".gitattributes", true)
test("CVS", true)
test(".svn", true)
test(".hg", true)
Expand Down

0 comments on commit 71b863a

Please sign in to comment.