feature<TextDiffView>: supports line staging/unstaging in working copy diff view

This commit is contained in:
leo 2024-02-27 21:13:52 +08:00
parent 91ef4e44a4
commit 671e46f8b3
10 changed files with 443 additions and 46 deletions

View 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;
}
}
}