Skip to content
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

Symlinks Not Showing as Symlinks #110

Merged
merged 2 commits into from
Jan 11, 2012
Merged

Conversation

cperl82
Copy link
Contributor

@cperl82 cperl82 commented Jan 11, 2012

Commit bc745b6 introduced code which changed how "hardPath" is calculated. Essentially it moved the addition of a "/" between the last path component and the rest of the path from s:Path.readInfoFromDisk() down into s:Path.strTrunk(). However, on my system this breaks the calculation of hardPath, as resolve() removes the trailing "/" returned by s:Path.strTrunk():

On my system, these two commands return different results:

:echo g:NERDTreeFileNode.GetSelected().path.strTrunk()
-> "/Users/cperl/tmp/2012-01-09/t/" (with trailing "/")

:echo resolve(g:NERDTreeFileNode.GetSelected().path.strTrunk())
-> "/Users/cperl/tmp/2012-01-09/t" (without trailing "/")

This means that for an example directory structure like this:

[cperl@screed ~/tmp/2012-01-09]$ tree -f -i t/
t
t/a
t/b -> a

2 directories, 0 files

hardPath for t/a becomes "/Users/cperl/tmp/2012-01-09/ta" and for t/b becomes "/Users/cperl/tmp/2012-01-09/tb". Since these are bogus paths, resolve(hardPath) will always be equal to hardPath and hence nothing will be flagged as a symlink.

Just as an example having nothing to do with NERDTree showing resolve removing the trailing slash:

:echo resolve("/foo/bar/baz/")
-> "/foo/bar/baz"

@cperl82
Copy link
Contributor Author

cperl82 commented Jan 11, 2012

Unfortunately the behavior of "resolve()" is not consistent. On my mac, vim version 7.3, the behavior is as described in the issue. However on a Solaris machine I have running vim 7.2, the behavior is different.

[cperl@screed ~]$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 15 2011 14:27:54)
MacOS X (unix) version
Included patches: 1-244, 246-353
...
[cperl@screed ~]$ vim --cmd ':echo resolve("/foo/bar/")' --cmd ':q!'
/foo/bar (<-- Trailing slash removed)

vs.

[cperl@solaris ~]$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 8 2009 19:55:42)
Included patches: 1-148
Compiled @build8x
...
[cperl@solaris ~]$ vim --cmd ':echo resolve("/foo/bar/")' --cmd ':q!'
/foo/bar/ (<-- Trailing slash not removed)

I'll put together something for you to pull to address this.

@scrooloose
Copy link
Collaborator

Hey, I havent forgotten about this, but if you want to send a pull request then even better :-)

This reverts commit bc745b6.  This
broke symlink detection on systems where vim's resolve() removes the
trailing slash from a path.
The core issue is that in some versions of vim resolve() will remove trailing
slashes, while in others it will not.  This lead to commit
bc745b6 attempting to address a double slash
problem.  However, that broke symlink detection on systems where resolve()
removes trailing slashes.  This new function just calls vim's resolve()
function, but removes trailing slashes if they exist.
scrooloose added a commit that referenced this pull request Jan 11, 2012
Symlinks Not Showing as Symlinks
@scrooloose scrooloose merged commit eced5f9 into preservim:master Jan 11, 2012
@scrooloose
Copy link
Collaborator

Cheers :)

@actionshrimp can you confirm that editing network shares still works as expected since one of your commits from #78 was reverted here.

@actionshrimp
Copy link
Contributor

The network shares seem unaffected by this - everything is still working as expected :-)

@scrooloose
Copy link
Collaborator

Sweet, cheers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants