Skip to content

Commit e52eb17

Browse files
committed
Merge branch 'release/v8.14'
2 parents 12d7fa6 + cd1c356 commit e52eb17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1105
-322
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.13
1+
8.14

build/build.linux.sh

100644100755
File mode changed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
exec /opt/sourcegit/sourcegit
2+
exec /opt/sourcegit/sourcegit $1

src/Commands/Branch.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,33 @@ public static bool SetUpstream(string repo, string name, string upstream)
3636
return cmd.Exec();
3737
}
3838

39-
public static bool Delete(string repo, string name)
39+
public static bool DeleteLocal(string repo, string name)
4040
{
4141
var cmd = new Command();
4242
cmd.WorkingDirectory = repo;
4343
cmd.Context = repo;
4444
cmd.Args = $"branch -D {name}";
4545
return cmd.Exec();
4646
}
47+
48+
public static bool DeleteRemote(string repo, string remote, string name)
49+
{
50+
var cmd = new Command();
51+
cmd.WorkingDirectory = repo;
52+
cmd.Context = repo;
53+
54+
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
55+
if (!string.IsNullOrEmpty(sshKey))
56+
{
57+
cmd.Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
58+
}
59+
else
60+
{
61+
cmd.Args = "-c credential.helper=manager ";
62+
}
63+
64+
cmd.Args += $"push {remote} --delete {name}";
65+
return cmd.Exec();
66+
}
4767
}
4868
}

src/Commands/Checkout.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public bool FileWithRevision(string file, string revision)
6262
return Exec();
6363
}
6464

65+
public bool Commit(string commitId, Action<string> onProgress)
66+
{
67+
Args = $"checkout --detach --progress {commitId}";
68+
TraitErrorAsOutput = true;
69+
_outputHandler = onProgress;
70+
return Exec();
71+
}
72+
6573
public bool Files(List<string> files)
6674
{
6775
StringBuilder builder = new StringBuilder();

src/Commands/Diff.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public partial class Diff : Command
1212
private const string PREFIX_LFS_DEL = "-version https://git-lfs.github.com/spec/";
1313
private const string PREFIX_LFS_MODIFY = " version https://git-lfs.github.com/spec/";
1414

15-
public Diff(string repo, Models.DiffOption opt)
15+
public Diff(string repo, Models.DiffOption opt, int unified)
1616
{
1717
WorkingDirectory = repo;
1818
Context = repo;
19-
Args = $"diff --ignore-cr-at-eol --unified=4 {opt}";
19+
Args = $"diff --ignore-cr-at-eol --unified={unified} {opt}";
2020
}
2121

2222
public Models.DiffResult Result()

src/Commands/Push.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,6 @@ public Push(string repo, string local, string remote, string remoteBranch, bool
3333
Args += $"{remote} {local}:{remoteBranch}";
3434
}
3535

36-
/// <summary>
37-
/// Only used to delete a remote branch!!!!!!
38-
/// </summary>
39-
/// <param name="repo"></param>
40-
/// <param name="remote"></param>
41-
/// <param name="branch"></param>
42-
public Push(string repo, string remote, string branch)
43-
{
44-
WorkingDirectory = repo;
45-
Context = repo;
46-
TraitErrorAsOutput = true;
47-
48-
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
49-
if (!string.IsNullOrEmpty(sshKey))
50-
{
51-
Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
52-
}
53-
else
54-
{
55-
Args = "-c credential.helper=manager ";
56-
}
57-
58-
Args += $"push {remote} --delete {branch}";
59-
}
60-
6136
public Push(string repo, string remote, string tag, bool isDelete)
6237
{
6338
WorkingDirectory = repo;

src/Commands/QueryBranches.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public partial class QueryBranches : Command
88
{
99
private const string PREFIX_LOCAL = "refs/heads/";
1010
private const string PREFIX_REMOTE = "refs/remotes/";
11+
private const string PREFIX_DETACHED = "(HEAD detached at";
1112

1213
[GeneratedRegex(@"^(\d+)\s(\d+)$")]
1314
private static partial Regex REG_AHEAD_BEHIND();
@@ -51,7 +52,12 @@ protected override void OnReadline(string line)
5152
var refName = parts[0];
5253
if (refName.EndsWith("/HEAD", StringComparison.Ordinal))
5354
return;
54-
55+
56+
if (refName.StartsWith(PREFIX_DETACHED, StringComparison.Ordinal))
57+
{
58+
branch.IsHead = true;
59+
}
60+
5561
if (refName.StartsWith(PREFIX_LOCAL, StringComparison.Ordinal))
5662
{
5763
branch.Name = refName.Substring(PREFIX_LOCAL.Length);

src/Commands/QueryCommits.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ private bool ParseDecorators(List<Models.Decorator> decorators, string data)
146146
Name = d.Substring(19).Trim(),
147147
});
148148
}
149+
else if (d.Equals("HEAD"))
150+
{
151+
isHeadOfCurrent = true;
152+
decorators.Add(new Models.Decorator()
153+
{
154+
Type = Models.DecoratorType.CurrentCommitHead,
155+
Name = d.Trim(),
156+
});
157+
}
149158
else if (d.StartsWith("refs/heads/", StringComparison.Ordinal))
150159
{
151160
decorators.Add(new Models.Decorator()

src/Commands/Tag.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ namespace SourceGit.Commands
55
{
66
public static class Tag
77
{
8-
public static bool Add(string repo, string name, string basedOn, string message)
8+
public static bool Add(string repo, string name, string basedOn)
99
{
1010
var cmd = new Command();
1111
cmd.WorkingDirectory = repo;
1212
cmd.Context = repo;
13-
cmd.Args = $"tag -a {name} {basedOn} ";
13+
cmd.Args = $"tag {name} {basedOn}";
14+
return cmd.Exec();
15+
}
16+
17+
public static bool Add(string repo, string name, string basedOn, string message, bool sign)
18+
{
19+
var param = sign ? "-s -a" : "-a";
20+
var cmd = new Command();
21+
cmd.WorkingDirectory = repo;
22+
cmd.Context = repo;
23+
cmd.Args = $"tag {param} {name} {basedOn} ";
1424

1525
if (!string.IsNullOrEmpty(message))
1626
{

0 commit comments

Comments
 (0)