Skip to content

Commit e0752f3

Browse files
Improved text file detection by checking common exesnsionless files like Makefile and Dockerfile
1 parent afbe485 commit e0752f3

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

internal/git/operations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func extractNonBinaryFiles(nameStatusOutput string) []string {
121121
_, nonBinaryFiles := processGitStatusOutput(nameStatusOutput, true)
122122
return nonBinaryFiles
123123
}
124-
}
125124

126125
// GetChanges retrieves all Git changes including staged, unstaged, and untracked files
127126
func GetChanges(config *types.RepoConfig) (string, error) {

internal/utils/utils.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,20 @@ func IsTextFile(filename string) bool {
3434
}
3535
}
3636

37-
// Files without extensions (like README, Dockerfile, Makefile) are treated as text
38-
// This ensures consistent behavior for common configuration and documentation files
37+
// Common extensionless files that are typically text
3938
if ext == "" {
40-
return true
39+
baseName := strings.ToLower(filepath.Base(filename))
40+
commonTextFiles := []string{
41+
"readme", "dockerfile", "makefile", "rakefile", "gemfile",
42+
"procfile", "jenkinsfile", "vagrantfile", "changelog", "authors",
43+
"contributors", "copying", "install", "news", "todo",
44+
}
45+
46+
for _, textFile := range commonTextFiles {
47+
if baseName == textFile {
48+
return true
49+
}
50+
}
4151
}
4252

4353
return false

0 commit comments

Comments
 (0)