Skip to content

Commit 3566d2c

Browse files
guillep2klunny
authored andcommitted
Include "executable" files in the index, as they are not necessarily binary (#7718)
1 parent 0639247 commit 3566d2c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

models/repo_indexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func addDelete(filename string, repo *Repository, batch rupture.FlushingBatch) e
232232
}
233233

234234
func isIndexable(entry *git.TreeEntry) bool {
235-
return entry.IsRegular()
235+
return entry.IsRegular() || entry.IsExecutable()
236236
}
237237

238238
// parseGitLsTreeOutput parses the output of a `git ls-tree -r --full-name` command

modules/git/tree_entry.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ func (te *TreeEntry) IsRegular() bool {
108108
return te.gogitTreeEntry.Mode == filemode.Regular
109109
}
110110

111+
// IsExecutable if the entry is an executable file (not necessarily binary)
112+
func (te *TreeEntry) IsExecutable() bool {
113+
return te.gogitTreeEntry.Mode == filemode.Executable
114+
}
115+
111116
// Blob returns the blob object the entry
112117
func (te *TreeEntry) Blob() *Blob {
113118
encodedObj, err := te.ptree.repo.gogitRepo.Storer.EncodedObject(plumbing.AnyObject, te.gogitTreeEntry.Hash)

0 commit comments

Comments
 (0)