Compare commits

..

No commits in common. "12d2b7721c83fb971ae0fbbf02dfea639f9f9825" and "1dfb629cef04619986bb9b624bfe224a7d49d1a7" have entirely different histories.

3 changed files with 4 additions and 10 deletions

View file

@ -27,7 +27,7 @@ namespace SourceGit.Commands
} }
} }
public static void RunAndWait(string repo, string file, string args, Models.ICommandLog log) public static void RunAndWait(string repo, string file, string args, Action<string> outputHandler)
{ {
var start = new ProcessStartInfo(); var start = new ProcessStartInfo();
start.FileName = file; start.FileName = file;
@ -40,22 +40,20 @@ namespace SourceGit.Commands
start.StandardErrorEncoding = Encoding.UTF8; start.StandardErrorEncoding = Encoding.UTF8;
start.WorkingDirectory = repo; start.WorkingDirectory = repo;
log?.AppendLine($"$ {file} {args}\n");
var proc = new Process() { StartInfo = start }; var proc = new Process() { StartInfo = start };
var builder = new StringBuilder(); var builder = new StringBuilder();
proc.OutputDataReceived += (_, e) => proc.OutputDataReceived += (_, e) =>
{ {
if (e.Data != null) if (e.Data != null)
log?.AppendLine(e.Data); outputHandler?.Invoke(e.Data);
}; };
proc.ErrorDataReceived += (_, e) => proc.ErrorDataReceived += (_, e) =>
{ {
if (e.Data != null) if (e.Data != null)
{ {
log?.AppendLine(e.Data); outputHandler?.Invoke(e.Data);
builder.AppendLine(e.Data); builder.AppendLine(e.Data);
} }
}; };

View file

@ -417,7 +417,6 @@ namespace SourceGit.Models
public void PushCommitMessage(string message) public void PushCommitMessage(string message)
{ {
message = message.Trim().ReplaceLineEndings("\n");
var existIdx = CommitMessages.IndexOf(message); var existIdx = CommitMessages.IndexOf(message);
if (existIdx == 0) if (existIdx == 0)
return; return;

View file

@ -36,16 +36,13 @@ namespace SourceGit.ViewModels
_repo.SetWatcherEnabled(false); _repo.SetWatcherEnabled(false);
ProgressDescription = "Run custom action ..."; ProgressDescription = "Run custom action ...";
var log = _repo.CreateLog(CustomAction.Name);
return Task.Run(() => return Task.Run(() =>
{ {
if (CustomAction.WaitForExit) if (CustomAction.WaitForExit)
Commands.ExecuteCustomAction.RunAndWait(_repo.FullPath, CustomAction.Executable, _args, log); Commands.ExecuteCustomAction.RunAndWait(_repo.FullPath, CustomAction.Executable, _args, output => CallUIThread(() => ProgressDescription = output));
else else
Commands.ExecuteCustomAction.Run(_repo.FullPath, CustomAction.Executable, _args); Commands.ExecuteCustomAction.Run(_repo.FullPath, CustomAction.Executable, _args);
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true)); CallUIThread(() => _repo.SetWatcherEnabled(true));
return true; return true;
}); });