-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Really long windows dirs #38
Open
TomKemperNL
wants to merge
2
commits into
victor-torres:master
Choose a base branch
from
TomKemperNL:really-long-windows-dirs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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 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,31 @@ | ||
require 'coffee-script/register' | ||
require './fakeWindow' | ||
HgRepository = require '../lib/hg-repository' | ||
TestRepository = require './testRepository' | ||
assert = require('chai').assert | ||
path = require 'path' | ||
exec = require('child_process').execSync | ||
|
||
isWindows = process.platform == 'win32' | ||
unless isWindows | ||
return | ||
|
||
describe 'In a repository with a really long path', -> | ||
testRepo = new TestRepository path.parse(__filename).name | ||
repo = null | ||
before -> | ||
testRepo.init() | ||
|
||
beforeEach -> | ||
repo = new HgRepository (testRepo.fullPath()) | ||
|
||
it 'should still return isPathIgnored true', -> | ||
ignored_file = path.join testRepo.fullPath(), 'ignored_file' | ||
repo.refreshStatus().then -> | ||
assert.equal(repo.isPathIgnored(ignored_file), true) | ||
|
||
after -> | ||
command = 'dir \'' + testRepo.fullPath() + '\\subDir*\' | rename-item -NewName a' | ||
command = 'powershell -command "' + command + '"' | ||
exec command | ||
testRepo.destroy() |
This file contains 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,18 @@ | ||
hg init $args[0] | ||
set-location $args[0] | ||
|
||
Set-Content -Path ".hgignore" -Value @" | ||
syntax:glob | ||
ignored_file | ||
"@ | ||
hg add ".hgignore" | ||
|
||
new-item -type File "ignored_file" | ||
new-item -type Directory "subdir" | ||
new-item -type File "subdir/some_file" | ||
|
||
$subDir = get-item "subdir" | ||
$path = $subDir.FullName | ||
$path = $path.PadRight(259, "A") | ||
|
||
rename-item "subdir" (Split-Path $path -Leaf) |
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.
What's the error thrown in this case? The result still comes from the stdout? Just files with path < 260?
If I'm right, maybe we need to put a comment here specifying that the error is probably something related to a big file path.
Whats leads us to: is there anything in the error message that could specify it better than its length being greater than 260 chars?
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.
Agreed, it ain't pretty.
The problem is that the error is just a string
/path/that/is/long could not find file or somesuch
The problem is that there is no error code or somesuch and windows error message could be localized, so I can't match the string.
Given that windows-paths can also contain spaces I'm not quite sure how to reliably recognize the situation.
The only case I could think of is deliberately trying to cause the error at startup with a well-known directory and saving 'the rest of the string'. But that sounds like a little bit too much work for such a small edge-case
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.
Very much open to suggestions though!
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.
Is
'could not find file' in stderr
a better solution thanstderr.length > 260
?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.
I don't think that works since the error message could be localized, so if I had the dutch language pack enabled it would be 'bestand kon niet gevonden worden' or somesuch.
...there's got to be a better way though.