diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-12-05 20:05:57 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-12-05 20:05:57 -0500 |
commit | 7282706b4265317e762a5c77ee3ff3afd5baf9f5 (patch) | |
tree | 65f33329b3bf49b44e3efde8b4a89e95a92346e2 /ignore | |
parent | 160f04894fea3fe47d1ce6231102aa52085bb4ef (diff) |
Fix bug reading root symlink.
When give an explicit file path on the command line like `foo` where `foo`
is a symlink, ripgrep should follow it even if `-L` isn't set. This is
consistent with the behavior of `foo/`.
Fixes #256
Diffstat (limited to 'ignore')
-rw-r--r-- | ignore/src/walk.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/ignore/src/walk.rs b/ignore/src/walk.rs index 43b1049c..70846dc8 100644 --- a/ignore/src/walk.rs +++ b/ignore/src/walk.rs @@ -275,18 +275,6 @@ impl DirEntryRaw { depth: depth, }) } - - fn from_path(depth: usize, pb: PathBuf) -> Result<DirEntryRaw, Error> { - let md = try!(fs::symlink_metadata(&pb).map_err(|err| { - Error::Io(err).with_path(&pb) - })); - Ok(DirEntryRaw { - path: pb, - ty: md.file_type(), - follow_link: false, - depth: depth, - }) - } } /// WalkBuilder builds a recursive directory iterator. @@ -756,7 +744,7 @@ impl WalkParallel { if path == Path::new("-") { DirEntry::new_stdin() } else { - match DirEntryRaw::from_path(0, path) { + match DirEntryRaw::from_link(0, path) { Ok(dent) => DirEntry::new_raw(dent, None), Err(err) => { if f(Err(err)).is_quit() { |