From 18f549d289b95b0de9e0f7b6c7d880b7752ea04d Mon Sep 17 00:00:00 2001
From: Andrew Gallant <jamslam@gmail.com>
Date: Mon, 19 Feb 2018 20:50:46 -0500
Subject: [PATCH] ignore: fix symlink following on Windows

This commit fixes a bug where symlinks were always being followed on
Windows, even if the user did not request it. This only impacts the
parallel iterator.

This is a regression from the fallout of fixing #705.

Fixes #824
---
 ignore/src/walk.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ignore/src/walk.rs b/ignore/src/walk.rs
index e43aa452..6a260f85 100644
--- a/ignore/src/walk.rs
+++ b/ignore/src/walk.rs
@@ -1026,6 +1026,11 @@ impl Work {
         self.dent.is_dir()
     }
 
+    /// Returns true if and only if this work item is a symlink.
+    fn is_symlink(&self) -> bool {
+        self.dent.file_type().map_or(false, |ft| ft.is_symlink())
+    }
+
     /// Adds ignore rules for parent directories.
     ///
     /// Note that this only applies to entries at depth 0. On all other
@@ -1112,7 +1117,7 @@ impl Worker {
         while let Some(mut work) = self.get_work() {
             // If the work is not a directory, then we can just execute the
             // caller's callback immediately and move on.
-            if !work.is_dir() {
+            if work.is_symlink() || !work.is_dir() {
                 if (self.f)(Ok(work.dent)).is_quit() {
                     self.quit_now();
                     return;