mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 05:35:00 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue