mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
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:
parent
00a2ec5abe
commit
3b1a54dffd
3 changed files with 24 additions and 11 deletions
23
src/Commands/UpdateRef.cs
Normal file
23
src/Commands/UpdateRef.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public class UpdateRef : Command
|
||||
{
|
||||
public UpdateRef(string repo, string refName, string toRevision, Action<string> outputHandler)
|
||||
{
|
||||
_outputHandler = outputHandler;
|
||||
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = $"update-ref {refName} {toRevision}";
|
||||
}
|
||||
|
||||
protected override void OnReadline(string line)
|
||||
{
|
||||
_outputHandler?.Invoke(line);
|
||||
}
|
||||
|
||||
private Action<string> _outputHandler;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue