summaryrefslogtreecommitdiffstats
path: root/git/git.go
diff options
context:
space:
mode:
authorLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-19 11:36:50 +0530
committerLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-19 11:36:50 +0530
commita05244018ae02603c56a27f8f8b7006c0024f7ea (patch)
treef01ac8969e4914421c8b7b0e3b1cf9f9b2892546 /git/git.go
parent8ba1a9609adef8575a91219ef35eef97daad8d32 (diff)
downloadlegit-a05244018ae02603c56a27f8f8b7006c0024f7ea.tar.gz
legit-a05244018ae02603c56a27f8f8b7006c0024f7ea.tar.bz2
legit-a05244018ae02603c56a27f8f8b7006c0024f7ea.zip
git: check for binary files
Diffstat (limited to '')
-rw-r--r--git/git.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/git/git.go b/git/git.go
index 3756840..34e8a80 100644
--- a/git/git.go
+++ b/git/git.go
@@ -76,7 +76,13 @@ func (g *GitRepo) FileContent(path string) (string, error) {
return "", err
}
- return file.Contents()
+ isbin, _ := file.IsBinary()
+
+ if !isbin {
+ return file.Contents()
+ } else {
+ return "Not displaying binary file", nil
+ }
}
func (g *GitRepo) Tags() ([]*object.Tag, error) {