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

[Feature Request] Not to show files listed in .git/info/exclude #180

Closed
chemio9 opened this issue May 25, 2024 · 7 comments
Closed

[Feature Request] Not to show files listed in .git/info/exclude #180

chemio9 opened this issue May 25, 2024 · 7 comments

Comments

@chemio9
Copy link

chemio9 commented May 25, 2024

Just as the title, maybe gitu could respect .git/info/exclude and not to show them in the file tree. Since I'm trying to use gitu to manage my dotfiles, listing every file in $HOME is not a good choice: have to wait for a couple of seconds that gitu could respond to user input.

Lazygit has this feature, but it seems to use the git command directly under the hood (I haven't read its code though.), so it might not be a proper reference.

@altsem
Copy link
Owner

altsem commented May 28, 2024

Hi!

I think it already does this. Could you provide some steps to reproduce the problem?
I might've misunderstood, or else I suspect there's an issue regarding submodules or something.

gitu on  altsem/value-arguments ❯ cat .git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
invisible.txt
gitu on  altsem/value-arguments ❯ git status
On branch altsem/value-arguments
Your branch is up to date with 'origin/altsem/value-arguments'.

nothing to commit, working tree clean
gitu on  altsem/value-arguments ❯ touch visible.txt invisible.txt
gitu on  altsem/value-arguments [?] ❯ git status
On branch altsem/value-arguments
Your branch is up to date with 'origin/altsem/value-arguments'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        visible.txt

nothing added to commit but untracked files present (use "git add" to track)

And in gitu:

▌On branch altsem/value-arguments
▌Your branch is up to date with 'origin/altsem/value-arguments'.

 Untracked files
 visible.txt

 Recent commits
 99a75bb altsem/value-arguments origin/altsem/value-arguments refactor: explicitly close `pending_menu`, access args from prompts
 4cb8b25 test: refactor src/tests/log, test grep/limit "other"
 eb26e0a Add more tests
 691b815 fix snapshots
 1d1d7c5 Fix value_as::<T>()
 994cfd3 rename get_args to init_args
 c70ebc3 refactor: extract type alies for set_prompt's `default_fn`
 439474c refactor: run `cargo clippy --fix`
 44d0f48 refactor: remove requirement of `clone` for Args
 5a61344 Add tests


@chemio9
Copy link
Author

chemio9 commented Jun 16, 2024

Sorry for the late reply! Quite busy these days.

I think it already does this.

I didn't notice it, sorry for the inconvenience.

However, there is an issue of lagging when starting gitu. I've recorded a video.

out.mp4

Take my dotfiles repo for an example, there is ~150 modified files, and ~40 untracked files, Starting Lazygit is fast, but when it comes to gitu, have to wait for 1~2s. As you can see, there is about 100 lines of exclude in my .git/info/exclude. So probably there is some other performance related issues? But it might be another issue.

@altsem
Copy link
Owner

altsem commented Jun 16, 2024

@chenrry666 No worries! Hmmm. I tried just creating a bunch of random files and listing them doesn't seem to take too long time. It's hard to tell from the video, but I'm guessing that filtering actually does fail.

Gitu is using libgit2 to retrieve the status. I found this open issue about the .gitignore (could be related?): libgit2/libgit2#6250

It'd be interesting to know more about your dotfiles setup.
Which OS are you on?
Do you use worktrees or is the repo a submodule?
Are the files not being ignored symlinks?

@chemio9
Copy link
Author

chemio9 commented Jun 16, 2024

I am using Arch Linux. The dotfiles repo isn't bare repo, so it is using worktree. The files are correctly ignored, sorry I didn't mention that.

The issue is that the lagging before the TUI being drawn may relate to some performance issues. Maybe the filtering process causes the lagging, IMO.

@altsem
Copy link
Owner

altsem commented Jun 16, 2024

Alright. It could be like you say. And the code is indeed not quite optimized and will try render everything (even though they're not shown).

How many files is it? I think git status --porcelain | wc -l would answer it :)

@chemio9
Copy link
Author

chemio9 commented Jun 16, 2024

I couldn't reach my laptop in two weeks at the moment. 🫠 It was sent for repair just this afternoon. Hence I could't provide more details in a short time.

I do remember there is more than 40k files in my $HOME (including yarn cache, crates, etc.) so it is probably where the lagging comes from. 🥲

@chemio9
Copy link
Author

chemio9 commented Jun 29, 2024

Luckily I am able to come back. Here are the results:

❯ git status --porcelain | wc -l
70
❯ find . -type f |wc -l
163871

Much files here 😰 but git has correctly ignored it.

@chemio9 chemio9 closed this as completed Oct 12, 2024
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

2 participants