mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
refactor<*>: rewrite all codes...
This commit is contained in:
28
src/Commands/QueryLFSObject.cs
Normal file
28
src/Commands/QueryLFSObject.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
/// <summary>
|
||||
/// 取得一个LFS对象的信息
|
||||
/// </summary>
|
||||
public class QueryLFSObject : Command {
|
||||
private Models.LFSObject obj = new Models.LFSObject();
|
||||
|
||||
public QueryLFSObject(string repo, string commit, string path) {
|
||||
Cwd = repo;
|
||||
Args = $"show {commit}:\"{path}\"";
|
||||
}
|
||||
|
||||
public Models.LFSObject Result() {
|
||||
Exec();
|
||||
return obj;
|
||||
}
|
||||
|
||||
public override void OnReadline(string line) {
|
||||
if (line.StartsWith("oid sha256:", StringComparison.Ordinal)) {
|
||||
obj.OID = line.Substring(11).Trim();
|
||||
} else if (line.StartsWith("size")) {
|
||||
obj.Size = int.Parse(line.Substring(4).Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user