aboutsummaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/repo_editor.go3
-rw-r--r--internal/db/repo_editor_test.go9
2 files changed, 11 insertions, 1 deletions
diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go
index 3edb16e2..0a1c9495 100644
--- a/internal/db/repo_editor.go
+++ b/internal/db/repo_editor.go
@@ -485,7 +485,10 @@ type UploadRepoFileOptions struct {
// isRepositoryGitPath returns true if given path is or resides inside ".git"
// path of the repository.
+//
+// TODO(unknwon): Move to repoutil during refactoring for this file.
func isRepositoryGitPath(path string) bool {
+ path = strings.ToLower(path)
return strings.HasSuffix(path, ".git") ||
strings.Contains(path, ".git/") ||
strings.Contains(path, `.git\`) ||
diff --git a/internal/db/repo_editor_test.go b/internal/db/repo_editor_test.go
index 6aeed011..f6178eda 100644
--- a/internal/db/repo_editor_test.go
+++ b/internal/db/repo_editor_test.go
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
)
-func Test_isRepositoryGitPath(t *testing.T) {
+func TestIsRepositoryGitPath(t *testing.T) {
tests := []struct {
path string
wantVal bool
@@ -21,6 +21,13 @@ func Test_isRepositoryGitPath(t *testing.T) {
{path: ".git/hooks", wantVal: true},
{path: "dir/.git", wantVal: true},
+ // Case-insensitive file system
+ {path: ".Git", wantVal: true},
+ {path: "./.Git", wantVal: true},
+ {path: ".Git/hooks/pre-commit", wantVal: true},
+ {path: ".Git/hooks", wantVal: true},
+ {path: "dir/.Git", wantVal: true},
+
{path: ".gitignore", wantVal: false},
{path: "dir/.gitkeep", wantVal: false},