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

Commit 4727302

Browse files
committed
AddBufferTag can accept relativePath
No need to convert from full path back to gitPath.
1 parent e46f894 commit 4727302

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ public async Task<ITextView> OpenFile(
120120

121121
if (!workingDirectory)
122122
{
123-
var gitPath = ToGitPath(session.LocalRepository, fullPath);
124-
AddBufferTag(wpfTextView.TextBuffer, session, gitPath, commitSha, null);
123+
AddBufferTag(wpfTextView.TextBuffer, session, relativePath, commitSha, null);
125124
EnableNavigateToEditor(textView, session);
126125
}
127126
}
@@ -487,17 +486,6 @@ static string GetAbsolutePath(LocalRepositoryModel localRepository, string relat
487486
return Path.Combine(localPath, relativePath);
488487
}
489488

490-
static string ToGitPath(LocalRepositoryModel localRepository, string path)
491-
{
492-
var basePath = localRepository.LocalPath + Path.DirectorySeparatorChar;
493-
if (path.StartsWith(basePath, StringComparison.OrdinalIgnoreCase))
494-
{
495-
return Paths.ToGitPath(path.Substring(basePath.Length));
496-
}
497-
498-
throw new ArgumentException($"Path '{path}' is not in the working directory '{localRepository.LocalPath}'");
499-
}
500-
501489
string GetText(IVsTextView textView)
502490
{
503491
IVsTextLines buffer;

0 commit comments

Comments
 (0)