feature: allow fetch the latest remote changes into local branch which is not current branch (#617)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-10-29 09:59:13 +08:00
parent 489b57858f
commit 1442dcfe00
No known key found for this signature in database
8 changed files with 102 additions and 2 deletions

View file

@ -21,6 +21,16 @@ namespace SourceGit.Commands
Args += remote;
}
public Fetch(string repo, Models.Branch local, Models.Branch remote, Action<string> outputHandler)
{
_outputHandler = outputHandler;
WorkingDirectory = repo;
Context = repo;
TraitErrorAsOutput = true;
SSHKey = new Config(repo).Get($"remote.{remote.Remote}.sshkey");
Args = $"fetch --progress --verbose {remote.Remote} {remote.Name}:{local.Name}";
}
protected override void OnReadline(string line)
{
_outputHandler?.Invoke(line);