@@ -13,7 +13,7 @@ namespace LibGit2Sharp
13
13
/// </summary>
14
14
public class TreeChanges : IEnumerable < TreeEntryChanges >
15
15
{
16
- private readonly IDictionary < string , TreeEntryChanges > changes = new Dictionary < string , TreeEntryChanges > ( ) ;
16
+ private readonly IDictionary < FilePath , TreeEntryChanges > changes = new Dictionary < FilePath , TreeEntryChanges > ( ) ;
17
17
private readonly List < TreeEntryChanges > added = new List < TreeEntryChanges > ( ) ;
18
18
private readonly List < TreeEntryChanges > deleted = new List < TreeEntryChanges > ( ) ;
19
19
private readonly List < TreeEntryChanges > modified = new List < TreeEntryChanges > ( ) ;
@@ -41,8 +41,8 @@ internal TreeChanges(DiffListSafeHandle diff)
41
41
42
42
private int PrintCallBack ( IntPtr data , GitDiffDelta delta , GitDiffRange range , GitDiffLineOrigin lineorigin , IntPtr content , uint contentlen )
43
43
{
44
- var formattedoutput = Utf8Marshaler . FromNative ( content , contentlen ) ;
45
- var currentFilePath = Utf8Marshaler . FromNative ( delta . NewFile . Path ) ;
44
+ string formattedoutput = Utf8Marshaler . FromNative ( content , contentlen ) ;
45
+ FilePath currentFilePath = FilePathMarshaler . FromNative ( delta . NewFile . Path ) ;
46
46
47
47
AddLineChange ( currentFilePath , lineorigin ) ;
48
48
@@ -57,7 +57,7 @@ private int PrintCallBack(IntPtr data, GitDiffDelta delta, GitDiffRange range, G
57
57
return 0 ;
58
58
}
59
59
60
- private void AddLineChange ( string currentFilePath , GitDiffLineOrigin lineOrigin )
60
+ private void AddLineChange ( FilePath currentFilePath , GitDiffLineOrigin lineOrigin )
61
61
{
62
62
switch ( lineOrigin )
63
63
{
@@ -71,22 +71,22 @@ private void AddLineChange(string currentFilePath, GitDiffLineOrigin lineOrigin)
71
71
}
72
72
}
73
73
74
- private void IncrementLinesDeleted ( string filePath )
74
+ private void IncrementLinesDeleted ( FilePath filePath )
75
75
{
76
76
linesDeleted ++ ;
77
77
this [ filePath ] . LinesDeleted ++ ;
78
78
}
79
79
80
- private void IncrementLinesAdded ( string filePath )
80
+ private void IncrementLinesAdded ( FilePath filePath )
81
81
{
82
82
linesAdded ++ ;
83
83
this [ filePath ] . LinesAdded ++ ;
84
84
}
85
85
86
86
private void AddFileChange ( GitDiffDelta delta )
87
87
{
88
- var newFilePath = Utf8Marshaler . FromNative ( delta . NewFile . Path ) ;
89
- var oldFilePath = Utf8Marshaler . FromNative ( delta . OldFile . Path ) ;
88
+ var newFilePath = FilePathMarshaler . FromNative ( delta . NewFile . Path ) ;
89
+ var oldFilePath = FilePathMarshaler . FromNative ( delta . OldFile . Path ) ;
90
90
var newMode = ( Mode ) delta . NewFile . Mode ;
91
91
var oldMode = ( Mode ) delta . OldFile . Mode ;
92
92
var newOid = new ObjectId ( delta . NewFile . Oid ) ;
@@ -95,7 +95,7 @@ private void AddFileChange(GitDiffDelta delta)
95
95
var diffFile = new TreeEntryChanges ( newFilePath , newMode , newOid , delta . Status , oldFilePath , oldMode , oldOid , delta . IsBinary ( ) ) ;
96
96
97
97
fileDispatcher [ delta . Status ] ( this , diffFile ) ;
98
- changes . Add ( diffFile . Path , diffFile ) ;
98
+ changes . Add ( newFilePath , diffFile ) ;
99
99
}
100
100
101
101
/// <summary>
@@ -120,6 +120,11 @@ IEnumerator IEnumerable.GetEnumerator()
120
120
/// Gets the <see cref = "TreeEntryChanges"/> corresponding to the specified <paramref name = "path"/>.
121
121
/// </summary>
122
122
public TreeEntryChanges this [ string path ]
123
+ {
124
+ get { return this [ ( FilePath ) path ] ; }
125
+ }
126
+
127
+ private TreeEntryChanges this [ FilePath path ]
123
128
{
124
129
get
125
130
{
0 commit comments