@@ -94,7 +94,7 @@ public virtual IEnumerable<Note> this[ObjectId id]
94
94
Ensure . ArgumentNotNull ( id , "id" ) ;
95
95
96
96
return NamespaceRefs
97
- . Select ( ns => RetrieveNote ( id , ns ) )
97
+ . Select ( ns => this [ ns , id ] )
98
98
. Where ( n => n != null ) ;
99
99
}
100
100
}
@@ -112,16 +112,28 @@ public virtual IEnumerable<Note> this[string @namespace]
112
112
string canonicalNamespace = NormalizeToCanonicalName ( @namespace ) ;
113
113
114
114
return Proxy . git_note_foreach ( repo . Handle , canonicalNamespace ,
115
- ( blobId , annotatedObjId ) => RetrieveNote ( annotatedObjId , canonicalNamespace ) ) ;
115
+ ( blobId , annotatedObjId ) => this [ canonicalNamespace , annotatedObjId ] ) ;
116
116
}
117
117
}
118
118
119
- internal Note RetrieveNote ( ObjectId targetObjectId , string canonicalNamespace )
119
+ /// <summary>
120
+ /// Gets the <see cref="Note"/> associated with the specified objectId and the specified namespace.
121
+ /// </summary>
122
+ public virtual Note this [ string @namespace , ObjectId id ]
120
123
{
121
- using ( NoteSafeHandle noteHandle = Proxy . git_note_read ( repo . Handle , canonicalNamespace , targetObjectId ) )
124
+ get
122
125
{
123
- return noteHandle == null ? null :
124
- Note . BuildFromPtr ( noteHandle , UnCanonicalizeName ( canonicalNamespace ) , targetObjectId ) ;
126
+ Ensure . ArgumentNotNull ( id , "id" ) ;
127
+ Ensure . ArgumentNotNull ( @namespace , "@namespace" ) ;
128
+
129
+ string canonicalNamespace = NormalizeToCanonicalName ( @namespace ) ;
130
+
131
+ using ( NoteSafeHandle noteHandle = Proxy . git_note_read ( repo . Handle , canonicalNamespace , id ) )
132
+ {
133
+ return noteHandle == null
134
+ ? null
135
+ : Note . BuildFromPtr ( noteHandle , UnCanonicalizeName ( canonicalNamespace ) , id ) ;
136
+ }
125
137
}
126
138
}
127
139
@@ -179,7 +191,7 @@ public virtual Note Add(ObjectId targetId, string message, Signature author, Sig
179
191
180
192
Proxy . git_note_create ( repo . Handle , author , committer , canonicalNamespace , targetId , message , true ) ;
181
193
182
- return RetrieveNote ( targetId , canonicalNamespace ) ;
194
+ return this [ canonicalNamespace , targetId ] ;
183
195
}
184
196
185
197
/// <summary>
0 commit comments