Permalink
Browse files

Merge branch 'pazustep/ignore-internal-symlink'

* pazustep/ignore-internal-symlink:
  doc: add Marcus Brito to list of authors
  Ignore internal or looped symlinks.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
  • Loading branch information...
2 parents e926704 + 7a310e5 commit 8463537a6850b87bc00383501118e758abc9678d @wincent committed Sep 7, 2012
Showing with 22 additions and 8 deletions.
  1. +14 −8 doc/command-t.txt
  2. +8 −0 ruby/command-t/scanner/file_scanner.rb
View
@@ -626,14 +626,15 @@ Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
Other contributors that have submitted patches include (in alphabetical
order):
- Anthony Panozzo Mike Lundy Steven Moazami
- Daniel Hahler Nate Kane Sung Pae
- Felix Tjandrawibawa Nicholas Alpi Thomas Pelletier
- Gary Bernhardt Nadav Samet Victor Hugo Borja
- Jeff Kreeftmeijer Noon Silk Woody Peterson
- Lucas de Vries Rainux Luo Yan Pritzker
- Marian Schubert Scott Bronson Zak Johnson
- Matthew Todd Seth Fowler
+ Anthony Panozzo Mike Lundy Sung Pae
+ Daniel Hahler Nate Kane Thomas Pelletier
+ Felix Tjandrawibawa Nicholas Alpi Victor Hugo Borja
+ Gary Bernhardt Nadav Samet Woody Peterson
+ Jeff Kreeftmeijer Noon Silk Yan Pritzker
+ Lucas de Vries Rainux Luo Zak Johnson
+ Marcus Brito Scott Bronson
+ Marian Schubert Seth Fowler
+ Matthew Todd Steven Moazami
As this was the first Vim plug-in I had ever written I was heavily influenced
by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
@@ -736,6 +737,11 @@ POSSIBILITY OF SUCH DAMAGE.
HISTORY *command-t-history*
+1.5 (not yet released)
+
+- don't scan "pathological" filesystem structures (ie. circular or
+ self-referential symlinks; patch from Marcus Brito)
+
1.4 (20 June 2012)
- added |:CommandTTag| command (patches from Noon Silk)
@@ -76,6 +76,13 @@ def path_excluded? path
::VIM::evaluate("empty(expand(fnameescape('#{path}')))").to_i == 1
end
+ def looped_symlink? path
+ if File.symlink?(path)
+ target = File.expand_path(File.readlink(path), File.dirname(path))
+ target.include?(@path) || @path.include?(target)
+ end
+ end
+
def add_paths_for_directory dir, accumulator
Dir.foreach(dir) do |entry|
next if ['.', '..'].include?(entry)
@@ -88,6 +95,7 @@ def add_paths_for_directory dir, accumulator
elsif File.directory?(path)
next if @depth >= @max_depth
next if (entry.match(/\A\./) && !@scan_dot_directories)
+ next if looped_symlink?(path)
@depth += 1
add_paths_for_directory path, accumulator
@depth -= 1

0 comments on commit 8463537

Please sign in to comment.