Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit cc43965

Browse files
committed
Change to use / separator for Git path
The new version of LibGit2Sharp expects / separators in Git paths. The previous version wasn't fussy.
1 parent b348527 commit cc43965

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/GitHub.Exports/Services/GitService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ public Task<ContentChanges> CompareWith(IRepository repository, string sha1, str
274274
var commit2 = repository.Lookup<Commit>(sha2);
275275

276276
var treeChanges = repository.Diff.Compare<TreeChanges>(commit1.Tree, commit2.Tree, defaultCompareOptions);
277-
var normalizedPath = path.Replace("/", "\\");
278-
var renamed = treeChanges.FirstOrDefault(x => x.Path == normalizedPath);
279-
var oldPath = renamed?.OldPath ?? path;
277+
var normalizedPath = path.Replace("\\", "/");
278+
var change = treeChanges.FirstOrDefault(x => x.Path == normalizedPath);
279+
var oldPath = change?.OldPath;
280280

281-
if (commit1 != null)
281+
if (commit1 != null && oldPath != null)
282282
{
283283
var contentStream = contents != null ? new MemoryStream(contents) : new MemoryStream();
284284
var blob1 = commit1[oldPath]?.Target as Blob ?? repository.ObjectDatabase.CreateBlob(new MemoryStream());

0 commit comments

Comments
 (0)