diff --git a/SourceGit/Git/Commit.cs b/SourceGit/Git/Commit.cs
index 7cbafad4..2b3c5c89 100644
--- a/SourceGit/Git/Commit.cs
+++ b/SourceGit/Git/Commit.cs
@@ -190,19 +190,19 @@ namespace SourceGit.Git {
///
///
///
- public string GetTextFileContent(Repository repo, string file) {
+ public string GetTextFileContent(Repository repo, string file, out bool isBinary) {
var data = new List();
- var isBinary = false;
var count = 0;
+ var binary = false;
var errs = repo.RunCommand($"show {SHA}:\"{file}\"", line => {
- if (isBinary) return;
+ if (binary) return;
count++;
if (data.Count >= 1000) return;
if (line.IndexOf('\0') >= 0) {
- isBinary = true;
+ binary = true;
data.Clear();
data.Add("BINARY FILE PREVIEW NOT SUPPORTED!");
return;
@@ -211,11 +211,13 @@ namespace SourceGit.Git {
data.Add(line);
});
- if (!isBinary && count > 1000) {
+ if (!binary && count > 1000) {
data.Add("...");
data.Add($"Total {count} lines. Hide {count-1000} lines.");
}
+ isBinary = binary;
+
if (errs != null) App.RaiseError(errs);
return string.Join("\n", data);
}
diff --git a/SourceGit/UI/CommitViewer.xaml b/SourceGit/UI/CommitViewer.xaml
index a7e71ade..7f68ffea 100644
--- a/SourceGit/UI/CommitViewer.xaml
+++ b/SourceGit/UI/CommitViewer.xaml
@@ -392,16 +392,24 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SourceGit/UI/CommitViewer.xaml.cs b/SourceGit/UI/CommitViewer.xaml.cs
index 66bda1e6..526841c3 100644
--- a/SourceGit/UI/CommitViewer.xaml.cs
+++ b/SourceGit/UI/CommitViewer.xaml.cs
@@ -345,13 +345,20 @@ namespace SourceGit.UI {
private async void FileTreeItemSelected(object sender, RoutedPropertyChangedEventArgs