mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-31 22:07:19 -08:00
34 lines
869 B
C#
34 lines
869 B
C#
using System;
|
|
|
|
namespace SourceGit.Commands
|
|
{
|
|
public class Fetch : Command
|
|
{
|
|
public Fetch(string repo, string remote, bool prune, bool noTags, Action<string> outputHandler)
|
|
{
|
|
_outputHandler = outputHandler;
|
|
WorkingDirectory = repo;
|
|
Context = repo;
|
|
TraitErrorAsOutput = true;
|
|
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
|
Args = "fetch --progress --verbose ";
|
|
|
|
if (prune)
|
|
Args += "--prune ";
|
|
|
|
if (noTags)
|
|
Args += "--no-tags ";
|
|
else
|
|
Args += "--force ";
|
|
|
|
Args += remote;
|
|
}
|
|
|
|
protected override void OnReadline(string line)
|
|
{
|
|
_outputHandler?.Invoke(line);
|
|
}
|
|
|
|
private readonly Action<string> _outputHandler;
|
|
}
|
|
}
|