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

feat: mark .git as ignored, which hides it when using --git-ignore #231

Merged
merged 2 commits into from
Sep 9, 2023

Conversation

ariasuni
Copy link
Contributor

@ariasuni ariasuni commented Sep 8, 2023

It makes a whole lot of sense to consider the .git at the root of a Git repository as ignored, since it kind is in practice.

But also, as ogham/exa#1214 shows, it’s useful to be able to hide .git when using eza --tree --all --git-ignore.

I tested the code and confirmed it worked perfectly well in three situations:

  • in eza’s repository
  • in another directory (I tested it in the exa repository, ../exa on my computer)
  • in the parent directory, in an empty Git repository just created with git init

@PThorpe92
Copy link
Member

Isn't --git-ignored more specific to git functionality?

Wouldn't you want to list every single file/folder in a directory that is included in the repo?
Idk how I feel specifically but the argument could definitely be made that the .git folder would be included in that list, as .git cannot ignore the .git folder.
I feel like hiding dotfiles additionally would be the option if you were not trying to list it. But I guess you might also say that someone may not want to hide all dotfiles, but they do want to hide just the .git folder?

Thoughts?

@ariasuni
Copy link
Contributor Author

ariasuni commented Sep 8, 2023

Wouldn't you want to list every single file/folder in a directory that is included in the repo?

Why? The .git directory is not part of the Git repository. When you use --git-ignore, you’re likely asking to see the files that are or can be committed to the repository, and ignoring what shouldn’t be committed. It’s not useful to show .git if you know you’re already in a Git repository.

Idk how I feel specifically but the argument could definitely be made that the .git folder would be included in that list, as .git cannot ignore the .git folder.

But in fact, Git ignores .git so much that it’s uncommittable.

I feel like hiding dotfiles additionally would be the option if you were not trying to list it. But I guess you might also say that someone may not want to hide all dotfiles, but they do want to hide just the .git folder?

Idk, it makes sense to me that you would like to see every file in your repository that you care about for development, and when you’re developing using Git, you don’t care about ignored files and the .git directory.

@PThorpe92
Copy link
Member

Idk, it makes sense to me that you would like to see every file in your repository that you care about for development, and when you’re developing using Git, you don’t care about ignored files and the .git directory.

Yeah you are right, I definitely see your point. It just initially felt like a weird line because we are talking about the very thing that is itself doing the ignoring.. if that makes any sense.

I think personally I don't mind seeing it, because it's just burned into me that I see that in the root of every repo. But I don't usually opt for the --git-ignore flag anyway.

But yeah, 👍 makes sense to me now

Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local manual testing and integration tests indicate this is working as expected and doesn't break anything.

Took me a few moment to see how this makes sense to do, but I see .git is implicit.

Thanks for the PR, LGTM, and merging when CI passes.

@cafkafk cafkafk merged commit c2204fc into main Sep 9, 2023
14 checks passed
@cafkafk cafkafk deleted the ignore-dot-git-when-using-git-ignore-flag branch September 9, 2023 04:44
@ariasuni
Copy link
Contributor Author

ariasuni commented Sep 9, 2023

Now that I think of it, I would have liked to add some documentation in the man page about this behavior ><

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

Successfully merging this pull request may close these issues.

None yet

3 participants