@@ -259,40 +259,42 @@ public Task<Remote> GetHttpRemote(IRepository repo, string remote)
259259 } ) ;
260260 }
261261
262- public Task < string > ExtractFile ( IRepository repository , string commitSha , string fileName )
262+ public Task < string > ExtractFile ( IRepository repository , string commitSha , string relativePath )
263263 {
264264 Guard . ArgumentNotNull ( repository , nameof ( repository ) ) ;
265265 Guard . ArgumentNotEmptyString ( commitSha , nameof ( commitSha ) ) ;
266- Guard . ArgumentIsGitPath ( fileName , nameof ( fileName ) ) ;
266+ Guard . ArgumentIsRelativePath ( relativePath , nameof ( relativePath ) ) ;
267267
268+ var gitPath = Paths . ToGitPath ( relativePath ) ;
268269 return Task . Run ( ( ) =>
269270 {
270271 var commit = repository . Lookup < Commit > ( commitSha ) ;
271272 if ( commit == null )
272273 {
273- throw new FileNotFoundException ( "Couldn't find '" + fileName + "' at commit " + commitSha + "." ) ;
274+ throw new FileNotFoundException ( "Couldn't find '" + gitPath + "' at commit " + commitSha + "." ) ;
274275 }
275276
276- var blob = commit [ fileName ] ? . Target as Blob ;
277+ var blob = commit [ gitPath ] ? . Target as Blob ;
277278 return blob ? . GetContentText ( ) ;
278279 } ) ;
279280 }
280281
281- public Task < byte [ ] > ExtractFileBinary ( IRepository repository , string commitSha , string fileName )
282+ public Task < byte [ ] > ExtractFileBinary ( IRepository repository , string commitSha , string relativePath )
282283 {
283284 Guard . ArgumentNotNull ( repository , nameof ( repository ) ) ;
284285 Guard . ArgumentNotEmptyString ( commitSha , nameof ( commitSha ) ) ;
285- Guard . ArgumentIsGitPath ( fileName , nameof ( fileName ) ) ;
286+ Guard . ArgumentIsRelativePath ( relativePath , nameof ( relativePath ) ) ;
286287
288+ var gitPath = Paths . ToGitPath ( relativePath ) ;
287289 return Task . Run ( ( ) =>
288290 {
289291 var commit = repository . Lookup < Commit > ( commitSha ) ;
290292 if ( commit == null )
291293 {
292- throw new FileNotFoundException ( "Couldn't find '" + fileName + "' at commit " + commitSha + "." ) ;
294+ throw new FileNotFoundException ( "Couldn't find '" + gitPath + "' at commit " + commitSha + "." ) ;
293295 }
294296
295- var blob = commit [ fileName ] ? . Target as Blob ;
297+ var blob = commit [ gitPath ] ? . Target as Blob ;
296298
297299 if ( blob != null )
298300 {
@@ -308,16 +310,17 @@ public Task<byte[]> ExtractFileBinary(IRepository repository, string commitSha,
308310 } ) ;
309311 }
310312
311- public Task < bool > IsModified ( IRepository repository , string path , byte [ ] contents )
313+ public Task < bool > IsModified ( IRepository repository , string relativePath , byte [ ] contents )
312314 {
313315 Guard . ArgumentNotNull ( repository , nameof ( repository ) ) ;
314- Guard . ArgumentIsGitPath ( path , nameof ( path ) ) ;
316+ Guard . ArgumentIsRelativePath ( relativePath , nameof ( relativePath ) ) ;
315317
318+ var gitPath = Paths . ToGitPath ( relativePath ) ;
316319 return Task . Run ( ( ) =>
317320 {
318- if ( repository . RetrieveStatus ( path ) == FileStatus . Unaltered )
321+ if ( repository . RetrieveStatus ( gitPath ) == FileStatus . Unaltered )
319322 {
320- var treeEntry = repository . Head [ path ] ;
323+ var treeEntry = repository . Head [ gitPath ] ;
321324 if ( treeEntry ? . TargetType != TreeEntryTargetType . Blob )
322325 {
323326 return false ;
@@ -326,7 +329,7 @@ public Task<bool> IsModified(IRepository repository, string path, byte[] content
326329 var blob1 = ( Blob ) treeEntry . Target ;
327330 using ( var s = contents != null ? new MemoryStream ( contents ) : new MemoryStream ( ) )
328331 {
329- var blob2 = repository . ObjectDatabase . CreateBlob ( s , path ) ;
332+ var blob2 = repository . ObjectDatabase . CreateBlob ( s , gitPath ) ;
330333 var diff = repository . Diff . Compare ( blob1 , blob2 ) ;
331334 return diff . LinesAdded != 0 || diff . LinesDeleted != 0 ;
332335 }
0 commit comments