Skip to content

Commit bacc1c8

Browse files
committed
enhance: reduce memory usage by commit detail view
1 parent 78c7168 commit bacc1c8

File tree

7 files changed

+385
-496
lines changed

7 files changed

+385
-496
lines changed

src/Commands/QueryRevisionObjects.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ namespace SourceGit.Commands
55
{
66
public partial class QueryRevisionObjects : Command
77
{
8-
98
[GeneratedRegex(@"^\d+\s+(\w+)\s+([0-9a-f]+)\s+(.*)$")]
109
private static partial Regex REG_FORMAT();
11-
private readonly List<Models.Object> objects = new List<Models.Object>();
1210

13-
public QueryRevisionObjects(string repo, string sha)
11+
public QueryRevisionObjects(string repo, string sha, string parentFolder)
1412
{
1513
WorkingDirectory = repo;
1614
Context = repo;
17-
Args = $"ls-tree -r {sha}";
15+
Args = $"ls-tree {sha}";
16+
17+
if (!string.IsNullOrEmpty(parentFolder))
18+
Args += $" -- \"{parentFolder}\"";
1819
}
1920

2021
public List<Models.Object> Result()
2122
{
2223
Exec();
23-
return objects;
24+
return _objects;
2425
}
2526

2627
protected override void OnReadline(string line)
@@ -50,7 +51,9 @@ protected override void OnReadline(string line)
5051
break;
5152
}
5253

53-
objects.Add(obj);
54+
_objects.Add(obj);
5455
}
56+
57+
private List<Models.Object> _objects = new List<Models.Object>();
5558
}
5659
}

src/Models/FileTreeNode.cs

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)