Windows integration tests: git file path quirk fix #1291
Merged
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.
Here's a test failure I experienced repeatably in ad-hoc Windows testing, but wasn't showing up in CI Windows testing:
Digging into
ExpectLocalHook
forexit status 128
found it was a failinggit add …
command. I added some debug output:That file is not outside the repository, but the
ADMINI~1
8.3 shortened directory name is suspicious.Indeed,
git add
of an absolute path containing an 8.3-shortening fails:While the same
git add
with the expanded long directory name works fine:The tilde path is coming from
ioutil.TempDir("", "git-repo")
which is documented at https://golang.org/pkg/io/ioutil/#TempDir but doesn't mention Windows things.A practical solution seems to be to resolve the output of TempDir to a long filename path somehow. Some attempts from package
filepath
:So, this PR runs the output of
ioutil.TempDir
throughfilepath.EvalSymlinks
to expand Windows tilde-paths. It runs on all platforms, not just Windows, but I don't think resolving symlinks will do any harm? And, it's test code, not production code.