refactor: use git update-ref $LOCAL_BRANCH $REMOTE_BRANCH instead of git fetch $REMOTE $LOCAL_BRANCH $REMOTE_BRANCH to fast-forward local branch without checkout it first.

This commit is contained in:
leo 2024-10-21 16:20:34 +08:00
parent 00a2ec5abe
commit 3b1a54dffd
No known key found for this signature in database
3 changed files with 24 additions and 11 deletions

View file

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