mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
refactor: base command
This commit is contained in:
parent
dda1e79c6f
commit
446445ee73
7 changed files with 42 additions and 85 deletions
|
@ -6,18 +6,13 @@ namespace SourceGit.Commands
|
|||
{
|
||||
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool force, bool track, Action<string> onProgress)
|
||||
{
|
||||
_outputHandler = onProgress;
|
||||
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
TraitErrorAsOutput = true;
|
||||
_outputHandler = onProgress;
|
||||
|
||||
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
||||
if (string.IsNullOrEmpty(sshKey))
|
||||
Args = "-c credential.helper=manager ";
|
||||
else
|
||||
UseSSHKey(sshKey);
|
||||
|
||||
Args += "push --progress --verbose ";
|
||||
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
||||
Args = "push --progress --verbose ";
|
||||
|
||||
if (withTags)
|
||||
Args += "--tags ";
|
||||
|
@ -33,16 +28,12 @@ namespace SourceGit.Commands
|
|||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
||||
Args = "push ";
|
||||
|
||||
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
||||
if (string.IsNullOrEmpty(sshKey))
|
||||
Args = "-c credential.helper=manager ";
|
||||
else
|
||||
UseSSHKey(sshKey);
|
||||
|
||||
Args += "push ";
|
||||
if (isDelete)
|
||||
Args += "--delete ";
|
||||
|
||||
Args += $"{remote} refs/tags/{tag}";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue