Skip to content

Commit 40bf30e

Browse files
committed
Add ContentChanges type
1 parent 3d92ae4 commit 40bf30e

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

LibGit2Sharp/ContentChanges.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Text;
2+
3+
namespace LibGit2Sharp
4+
{
5+
/// <summary>
6+
/// Holds the changes between two <see cref = "Blob" />s.
7+
/// </summary>
8+
public class ContentChanges
9+
{
10+
private readonly StringBuilder patchBuilder = new StringBuilder();
11+
12+
protected ContentChanges()
13+
{
14+
}
15+
16+
/// <summary>
17+
/// The number of lines added.
18+
/// </summary>
19+
public int LinesAdded { get; internal set; }
20+
21+
/// <summary>
22+
/// The number of lines deleted.
23+
/// </summary>
24+
public int LinesDeleted { get; internal set; }
25+
26+
/// <summary>
27+
/// The patch corresponding to these changes.
28+
/// </summary>
29+
public string Patch
30+
{
31+
get { return patchBuilder.ToString(); }
32+
}
33+
34+
internal StringBuilder PatchBuilder
35+
{
36+
get { return patchBuilder; }
37+
}
38+
}
39+
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<Compile Include="Commit.cs" />
5050
<Compile Include="CommitCollection.cs" />
5151
<Compile Include="Configuration.cs" />
52+
<Compile Include="ContentChanges.cs" />
5253
<Compile Include="Core\Compat\Environment.cs" />
5354
<Compile Include="Core\FilePath.cs" />
5455
<Compile Include="Core\FilePathExtensions.cs" />

LibGit2Sharp/TreeEntryChanges.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
using System.Text;
2-
using LibGit2Sharp.Core;
32

43
namespace LibGit2Sharp
54
{
65
/// <summary>
76
/// Holds the changes between two versions of a tree entry.
87
/// </summary>
9-
public class TreeEntryChanges
8+
public class TreeEntryChanges : ContentChanges
109
{
11-
private readonly StringBuilder patchBuilder = new StringBuilder();
12-
1310
internal TreeEntryChanges(string path, Mode mode, ChangeKind status, string oldPath, Mode oldMode)
1411
{
1512
Path = path;
@@ -43,28 +40,5 @@ internal TreeEntryChanges(string path, Mode mode, ChangeKind status, string oldP
4340
/// The old <see cref="Mode"/>.
4441
/// </summary>
4542
public Mode OldMode { get; private set; }
46-
47-
/// <summary>
48-
/// The number of lines added.
49-
/// </summary>
50-
public int LinesAdded { get; internal set; }
51-
52-
/// <summary>
53-
/// The number of lines deleted.
54-
/// </summary>
55-
public int LinesDeleted { get; internal set; }
56-
57-
/// <summary>
58-
/// The patch corresponding to these changes.
59-
/// </summary>
60-
public string Patch
61-
{
62-
get { return patchBuilder.ToString(); }
63-
}
64-
65-
internal StringBuilder PatchBuilder
66-
{
67-
get { return patchBuilder; }
68-
}
6943
}
7044
}

0 commit comments

Comments
 (0)