mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
feature<TextDiffView>: supports line staging/unstaging in working copy diff view
This commit is contained in:
parent
91ef4e44a4
commit
671e46f8b3
10 changed files with 443 additions and 46 deletions
23
src/Commands/QueryStagedFileBlobGuid.cs
Normal file
23
src/Commands/QueryStagedFileBlobGuid.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
public class QueryStagedFileBlobGuid : Command {
|
||||
private static readonly Regex REG_FORMAT = new Regex(@"^\d+\s+([0-9a-f]+)\s+.*$");
|
||||
|
||||
public QueryStagedFileBlobGuid(string repo, string file) {
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = $"ls-files -s -- \"{file}\"";
|
||||
}
|
||||
|
||||
public string Result() {
|
||||
var rs = ReadToEnd();
|
||||
var match = REG_FORMAT.Match(rs.StdOut.Trim());
|
||||
if (match.Success) {
|
||||
return match.Groups[1].Value;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue