-
Notifications
You must be signed in to change notification settings - Fork 434
Expand file tree
/
Copy pathFetch.cs
More file actions
51 lines (39 loc) · 1.32 KB
/
Copy pathFetch.cs
File metadata and controls
51 lines (39 loc) · 1.32 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Threading.Tasks;
namespace SourceGit.Commands
{
public class Fetch : Command
{
public Fetch(string repo, string remote, bool noTags, bool force, int depth)
{
_remoteKey = $"remote.{remote}.sshkey";
WorkingDirectory = repo;
Context = repo;
Args = "fetch --progress --verbose ";
if (noTags)
Args += "--no-tags ";
else
Args += "--tags ";
if (force)
Args += "--force ";
if(depth > 0)
Args += $"--depth {depth} ";
Args += remote;
}
public Fetch(string repo, Models.Branch local, Models.Branch remote, int depth)
{
_remoteKey = $"remote.{remote.Remote}.sshkey";
WorkingDirectory = repo;
Context = repo;
Args = "fetch --progress --verbose ";
if(depth > 0)
Args += $"--depth {depth} ";
Args += $"{remote.Remote} {remote.Name}:{local.Name}";
}
public async Task<bool> RunAsync()
{
SSHKey = await new Config(WorkingDirectory).GetAsync(_remoteKey).ConfigureAwait(false);
return await ExecAsync().ConfigureAwait(false);
}
private readonly string _remoteKey;
}
}