More work on porting diff kitten

This commit is contained in:
Kovid Goyal
2023-03-27 07:53:54 +05:30
parent ee82cb5a52
commit 5d8b5ab720
5 changed files with 210 additions and 8 deletions
+5 -1
View File
@@ -64,9 +64,13 @@ func data_for_path(path string) (string, error) {
})
}
func is_image(path string) bool {
return strings.HasPrefix(mimetype_for_path(path), "image/")
}
func is_path_text(path string) bool {
return is_text_cache.MustGetOrCreate(path, func(path string) bool {
if strings.HasPrefix(mimetype_for_path(path), "image/") {
if is_image(path) {
return false
}
s1, err := os.Stat(path)