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

exa treats gitignore /s literally #369

Closed
CosmicToast opened this issue Mar 29, 2018 · 5 comments
Closed

exa treats gitignore /s literally #369

CosmicToast opened this issue Mar 29, 2018 · 5 comments

Comments

@CosmicToast
Copy link

Example test:

Take the following repository structure:

.
├── .gitignore
└── a
│  └── x
└── b
   └── x

with the contents of .gitignore being:

a/
/b

exa --tree --git-ignore will show all of the files.
In comparison, fd and rg --files will show no output.

@rpdelaney
Copy link

I came here to post this. For bizarre reasons / is considered by gitignore to be the root of the repository, not the filesystem.

@tjkirch
Copy link

tjkirch commented Sep 5, 2018

I use a leading "/" quite often to block objects that only appear at the root of a repo, like "/target" for Rust/Cargo projects. I was pretty confused to see exa listing them when --git-ignore is specified.

@Lucretiel
Copy link

I came here to post this. For bizarre reasons / is considered by gitignore to be the root of the repository, not the filesystem.

Doesn't seem that bizarre; this seems like a reasonable convention to indicate you want to ignore "project_root/target" but not "project_root/src/target"

@CosmicToast
Copy link
Author

Since there appears to be some confusion, let's clarify:
This is the gitignore documentation, and should serve as the implementation basis for any gitignore-related functionality.

As per said documentation:

A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

In terms of being relative to the filesystem, git does not consider the filesystem paths because git has no control over where the checkout happens. If someone has a checkout in /git/x and has /git/x/y in the gitignore, what happens if someone checked the same repository out in ~/x?

Gitignore only makes sense in the scope of git (rather than the larger filesystem) and thus must not consider anything outside of the repository (including in alternative implemetations, such as here).

(requirement keywords as per rfc2119)

@ariasuni
Copy link
Collaborator

This has been fixed by #653.

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

No branches or pull requests

5 participants