Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Handling file names that look like they are a drive letter #921

Merged
merged 3 commits into from
Oct 4, 2018

Conversation

StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Oct 3, 2018

In a user's repo the file c:UsersOculusGoVideo.mp4 exists in history and trips up the log parsing process. The fix is being made in NPath (our IO library).

private static string ParseDriveLetter(string path, out string driveLetter)
{
if (path.Length >= 3 && path[1] == ':' && (path[2] == '/' || path[2] == '\\'))
{
driveLetter = path[0].ToString();
return path.Substring(2);
}
driveLetter = null;
return path;
}

Tests have been added to verify this case works.

Fixes: #922
Related to #899 - #899 (comment)

Copy link

@queerviolet queerviolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, like the tests 👍

var gitObjectFactory = new GitObjectFactory(environment);
var gitStatusEntry = gitObjectFactory.CreateGitStatusEntry("c:UsersOculusGoVideo.mp4", GitFileStatus.Deleted);

Assert.AreEqual(@"c:\Projects\UnityProject\c:UsersOculusGoVideo.mp4", gitStatusEntry.FullPath);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHO NAMES THEIR FILES THIS? 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

@StanleyGoldman StanleyGoldman merged commit 586de7a into master Oct 4, 2018
@StanleyGoldman StanleyGoldman deleted the strange-file-names branch October 4, 2018 11:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files that look like a drive letter trip up log processing
2 participants