diff --git a/v23/util.go b/v23/util.go index 2bb11d74..6455a865 100644 --- a/v23/util.go +++ b/v23/util.go @@ -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. diff --git a/v23/util_test.go b/v23/util_test.go index 2109bb78..a8963678 100644 --- a/v23/util_test.go +++ b/v23/util_test.go @@ -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)