-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathPush.cs
37 lines (32 loc) · 1.1 KB
/
Push.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace SourceGit.Commands
{
public class Push : Command
{
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool checkSubmodules, bool track, bool force)
{
WorkingDirectory = repo;
Context = repo;
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
Args = "push --progress --verbose ";
if (withTags)
Args += "--tags ";
if (checkSubmodules)
Args += "--recurse-submodules=check ";
if (track)
Args += "-u ";
if (force)
Args += "--force-with-lease ";
Args += $"{remote} {local}:{remoteBranch}";
}
public Push(string repo, string remote, string refname, bool isDelete)
{
WorkingDirectory = repo;
Context = repo;
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
Args = "push ";
if (isDelete)
Args += "--delete ";
Args += $"{remote} {refname}";
}
}
}