This repository was archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Be consistent about how we use relative paths and Git paths #2386
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4f6b57e
Pass Git path to PullRequestTextBufferInfo
jcansdale 8ae29c8
FindGitRelativePath should always return a path or error
StanleyGoldman 5fe36d6
Use relativePath and gitPath in a consistent way
jcansdale f8c52cd
Factor out ToGitPath and ToRelativePath
jcansdale eec41c3
Fix GetOldFileName
jcansdale ff60575
Use relativeOrGitPath when it doesn't matter
jcansdale e46f894
Add xmldoc comments to Paths
jcansdale 4727302
AddBufferTag can accept relativePath
jcansdale cd67be2
Remove unnecessary GetAbsolutePath method
jcansdale 286d287
Add Path_Can_Use_Windows_Directory_Separator test
jcansdale 52f2bf0
Rename to Paths.ToWindowsPath from ToRelativePath
jcansdale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| using System; | ||
| using System.IO; | ||
|
|
||
| namespace GitHub.Primitives | ||
| { | ||
| /// <summary> | ||
| /// Convert to and from Git paths. | ||
| /// </summary> | ||
| public static class Paths | ||
| { | ||
| public const char GitDirectorySeparatorChar = '/'; | ||
|
|
||
| /// <summary> | ||
| /// Convert from a relative path to a Git path. | ||
| /// </summary> | ||
| /// <param name="relativePath">A relative path.</param> | ||
| /// <returns>A working directory relative path which uses the '/' directory separator.</returns> | ||
| public static string ToGitPath(string relativePath) | ||
| { | ||
| return relativePath.Replace(Path.DirectorySeparatorChar, GitDirectorySeparatorChar); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Convert from a Git path to a path that uses the Windows directory separator ('\'). | ||
| /// </summary> | ||
| /// <param name="gitPath">A relative path that uses the '/' directory separator.</param> | ||
| /// <returns>A relative path that uses the <see cref="Path.DirectorySeparatorChar"/> directory separator ('\' on Windows).</returns> | ||
| public static string ToWindowsPath(string gitPath) | ||
| { | ||
| return gitPath.Replace(GitDirectorySeparatorChar, Path.DirectorySeparatorChar); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix for #2380.
AddBufferTagexpects a relative path.