]> source.dussan.org Git - gitea.git/commitdiff
Include "executable" files in the index, as they are not necessarily binary (#7718)
authorguillep2k <github.com@mailfilter.com.ar>
Fri, 2 Aug 2019 15:14:50 +0000 (12:14 -0300)
committerLunny Xiao <xiaolunwen@gmail.com>
Fri, 2 Aug 2019 15:14:50 +0000 (23:14 +0800)
models/repo_indexer.go
modules/git/tree_entry.go

index 83383807a79285bab8504c6d104eb23972353ee4..3a41e0525ac3bfae3a4b0eb7f950914e4f898b1e 100644 (file)
@@ -232,7 +232,7 @@ func addDelete(filename string, repo *Repository, batch rupture.FlushingBatch) e
 }
 
 func isIndexable(entry *git.TreeEntry) bool {
-       return entry.IsRegular()
+       return entry.IsRegular() || entry.IsExecutable()
 }
 
 // parseGitLsTreeOutput parses the output of a `git ls-tree -r --full-name` command
index 6019e34487fe33e6e993b2114eec0dbb46a53d13..4e18cc8ead2f35df40b94f97cf7c1f8889abdd58 100644 (file)
@@ -108,6 +108,11 @@ func (te *TreeEntry) IsRegular() bool {
        return te.gogitTreeEntry.Mode == filemode.Regular
 }
 
+// IsExecutable if the entry is an executable file (not necessarily binary)
+func (te *TreeEntry) IsExecutable() bool {
+       return te.gogitTreeEntry.Mode == filemode.Executable
+}
+
 // Blob returns the blob object the entry
 func (te *TreeEntry) Blob() *Blob {
        encodedObj, err := te.ptree.repo.gogitRepo.Storer.EncodedObject(plumbing.AnyObject, te.gogitTreeEntry.Hash)