fix<CommitViewer>: fix save revision file to path error when selected file is managed by LFS

This commit is contained in:
leo 2020-11-18 20:05:41 +08:00
parent 0e48344401
commit db799f5c92
3 changed files with 37 additions and 29 deletions

View file

@ -184,32 +184,6 @@ namespace SourceGit.Git {
return RunCommand(Path, args, outputHandler, includeError);
}
/// <summary>
/// Create process and redirect output to file.
/// </summary>
/// <param name="args">Git command arguments.</param>
/// <param name="redirectTo">File path to redirect output into.</param>
public void RunAndRedirect(string args, string redirectTo) {
var startInfo = new ProcessStartInfo();
startInfo.FileName = Preference.Instance.GitExecutable;
startInfo.Arguments = "--no-pager " + args;
startInfo.WorkingDirectory = Path;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
var proc = new Process() { StartInfo = startInfo };
proc.Start();
using (var writer = new FileStream(redirectTo, FileMode.OpenOrCreate)) {
proc.StandardOutput.BaseStream.CopyTo(writer);
}
proc.WaitForExit();
proc.Close();
}
/// <summary>
/// Assert command result and then update branches and commits.
/// </summary>