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

Current directory not included when using relative path #81

Closed
jakwings opened this issue Oct 8, 2017 · 3 comments
Closed

Current directory not included when using relative path #81

jakwings opened this issue Oct 8, 2017 · 3 comments
Labels
Milestone

Comments

@jakwings
Copy link
Contributor

jakwings commented Oct 8, 2017

$ fd --version
fd 4.0.0

In directory "a":

$ tree -F ..
..
├── a/
│   └── a
├── b/
└── c/
$ fd . .
a
$ fd . ..
../b
../c
a

In directory "b":

$ fd . ..
../a
../a/a
../c
@sharkdp sharkdp added the bug label Oct 8, 2017
@jakwings
Copy link
Contributor Author

jakwings commented Oct 8, 2017

This bug continues with symbolic links:

$ ln -sr a d
$ tree -F
.
├── a/
│   └── a
├── b/
├── c/
└── d -> a/
$ cd d
$ fd . ..
../b
../c
../d
a

@sharkdp
Copy link
Owner

sharkdp commented Oct 8, 2017

Good catch. It seems to work if -a is used. On the other hand, using -a also includes the parent directory (..). It shouldn't change the search results at all. Definitely a bug.

@jakwings
Copy link
Contributor Author

jakwings commented Oct 8, 2017

BTW, would fd simulate the behavior of find, which includes . and .. for fd . . (or just fd) and fd . .. respectively?

EDIT: fix

sharkdp added a commit that referenced this issue Oct 11, 2017
Previously, we were using the relative path to extract the search
string. For the current directory, the returned relative path was equal
to `""`. This is why the current directory did not show in the search
results (see #81).

This commit also changes the way that `--full-path` works, which was
previously working on relative paths. It seems more useful to search the
absolute path, though. Otherwise, search results could change just by
calling fd (with a given search path) from a different directory.
sharkdp added a commit that referenced this issue Oct 12, 2017
Previously, we were using the relative path to extract the search
string. For the current directory, the returned relative path was equal
to `""`. This is why the current directory did not show in the search
results (see #81).

This commit also changes the way that `--full-path` works, which was
previously working on relative paths. It seems more useful to search the
absolute path, though. Otherwise, search results could change just by
calling fd (with a given search path) from a different directory.
@sharkdp sharkdp added this to the v5.0 milestone Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants