Merge branch 'master' into enh/noid/commit-message-link-check-commit-hashes

This commit is contained in:
Lunny Xiao
2019-08-05 21:00:59 +08:00
committed by GitHub
38 changed files with 551 additions and 88 deletions

View 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)

View File

@@ -19,9 +19,11 @@ var (
}
// File names that are representing highlight classes.
highlightFileNames = map[string]bool{
"dockerfile": true,
"makefile": true,
highlightFileNames = map[string]string{
"dockerfile": "dockerfile",
"makefile": "makefile",
"gnumakefile": "makefile",
"cmakelists.txt": "cmake",
}
// Extensions that are same as highlight classes.
@@ -87,8 +89,8 @@ func FileNameToHighlightClass(fname string) string {
return "nohighlight"
}
if highlightFileNames[fname] {
return fname
if name, ok := highlightFileNames[fname]; ok {
return name
}
ext := path.Ext(fname)