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

Hidden files feature is not functional #274

Closed
mwshinn opened this issue Sep 4, 2020 · 14 comments
Closed

Hidden files feature is not functional #274

mwshinn opened this issue Sep 4, 2020 · 14 comments

Comments

@mwshinn
Copy link

mwshinn commented Sep 4, 2020

Is everything clear?
I don't want to sign in with github/google/etc credentials on this chat website, so I did not try the chat.

Describe the bug
Toggling hidden files does not seem to work.

To Reproduce

  1. Enter broot in ~ directory, which contains many hidden files and folders. None of these are visible.
  2. Press space and then h and then enter to toggle hidden files. A notification is displayed that hidden files were toggled.
  3. Hidden files are still not displayed.
  4. To confirm I didn't turn it off by toggling, repeat step 2.
  5. Hidden files are still not displayed.

This problem persists when invoking using "br --hidden"

It is also not possible to find hidden files with search. E.g. start by searching ".config" or "config" does not display the .config directory. This also applies to files: doing the same for .emacs does not return any hits for the relevant file.

Expected behavior
Hidden files should be displayed when the appropriate flag is turned on.

Configuration (please complete the following information):

  • OS: Linux 4.18.0-17-generic Documentation link broken #18~18.04.1-Ubuntu SMP Fri Mar 15 15:27:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Version: broot 1.0.0 (installed from github linux binary)
  • Relevant configuration items: Configuration was reset to stock for the purpose of testing

Additional context
dev.log file is given below for the procedure described in "to reproduce":

14:08:58 [ INFO] Starting Broot v1.0.0 with log level DEBUG
14:08:58 [DEBUG] (1) broot::app::context: COLORTERM env variable = "truecolor"
14:08:58 [DEBUG] (1) broot::app::context: true colors are available
14:08:58 [DEBUG] (1) broot::git::ignore: GitIgnoreFile::new took 118.618µs
14:08:58 [DEBUG] (1) broot::tree_build::builder: GitIgnorer::default took 244.043µs
14:08:58 [DEBUG] (1) broot::tree_build::builder: trimming prematurely interrupted
14:08:58 [DEBUG] (1) broot::app::app: display panel took 377.085µs
14:09:03 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Char(' '), modifiers: NONE })
14:09:03 [DEBUG] (1) broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "", args: None, bang: false })
14:09:03 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(Keep)
14:09:03 [DEBUG] (1) broot::app::app: display panel took 753.089µs
14:09:04 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Char('h'), modifiers: NONE })
14:09:04 [DEBUG] (1) broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "h", args: None, bang: false })
14:09:04 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(Keep)
14:09:04 [DEBUG] (1) broot::app::app: display panel took 654.121µs
14:09:04 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Enter, modifiers: NONE })
14:09:04 [DEBUG] (1) broot::app::app: command after add_event: VerbInvocate(VerbInvocation { name: "h", args: None, bang: false })
14:09:04 [DEBUG] (1) broot::tree_build::builder: GitIgnorer::default took 13.182µs
14:09:04 [DEBUG] (1) broot::tree_build::builder: trimming prematurely interrupted
14:09:04 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(NewState)
14:09:04 [DEBUG] (1) broot::app::app: display panel took 220.007µs
14:09:07 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Char(' '), modifiers: NONE })
14:09:07 [DEBUG] (1) broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "", args: None, bang: false })
14:09:07 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(Keep)
14:09:07 [DEBUG] (1) broot::app::app: display panel took 749.342µs
14:09:07 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Char('h'), modifiers: NONE })
14:09:07 [DEBUG] (1) broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "h", args: None, bang: false })
14:09:07 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(Keep)
14:09:07 [DEBUG] (1) broot::app::app: display panel took 751.16µs
14:09:08 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Enter, modifiers: NONE })
14:09:08 [DEBUG] (1) broot::app::app: command after add_event: VerbInvocate(VerbInvocation { name: "h", args: None, bang: false })
14:09:08 [DEBUG] (1) broot::tree_build::builder: GitIgnorer::default took 10.795µs
14:09:08 [DEBUG] (1) broot::tree_build::builder: trimming prematurely interrupted
14:09:08 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(NewState)
14:09:08 [DEBUG] (1) broot::app::app: display panel took 205.058µs
14:09:11 [DEBUG] (1) broot::app::app: event: Key(KeyEvent { code: Char('q'), modifiers: CONTROL })
14:09:11 [DEBUG] (1) broot::app::app: command after add_event: VerbTrigger { index: 43, input_invocation: None }
14:09:11 [DEBUG] (1) broot::app::panel: result in panel PanelId(0): Ok(Quit)
14:09:11 [DEBUG] (1) broot::task_sync: dead dam
14:09:11 [ INFO] bye
@Canop
Copy link
Owner

Canop commented Sep 4, 2020

This is a strange one. Any idea of anything specific which could explain the problem ?

Are hidden files visible if you launch broot with br -h ~ ?

Could you join a screenshot ?

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

Here are two screenshots, one of the directory I created to test this with, and one of the invocation of "br -h".

Screenshot from 2020-09-04 10-54-12
Screenshot from 2020-09-04 10-55-08

I'm not sure what could be causing it... I don't think there is anything abnormal with my setup.

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

Okay, I was looking through the code and it seemed that git integration was important here. When I run ":toggle_git_ignore" and ":toggle_git_status", then the hidden files show up. Furthermore, I can run ":toggle_git_status" again and they still stay visible. So it seems that if ":toggle_git_status" is run at least once, and ":toggle_git_ignore" is off, then the hidden files show up. It does not work if I just run ":toggle_git_ignore" - ":toggle_git_status" must be run at least once, but it doesn't matter how many times it is toggled as long as it is toggled once.

Also, starting with "br -ig", "br -iG", "br -Ig", and "br -IG" do not fix the problem, but "br -i --git-status" does.

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

(Also, to clarify, neither the folder I am running this from nor any of its parent folders are a git repo.)

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

Can you check you have the same problem if you directly launch broot as broot (ie not as br) ?

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

@mwshinn I've built a special version with more logs. Could you please try it (and show me the debug log f broot -h ~) ?

It's at https://dystroy.org/broot/dev-download/broot

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

Yes, the same problem happens when I just launch broot, not as br. With the new binary, I did the following steps:

  1. Run "BROOT_LOG=debug broot -h" with the version of broot you sent
  2. Run ":toggle_git_status"
  3. Run ":toggle_git_ignore"
  4. See the hidden files come up

This produced the attached log.
dev.log

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

This isn't the version I just built but the standard version. You can check the new one is called 1.0.0-dev in the help screen

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

Oops, sorry, you're right. Here's the correct log:

dev.log

Also, I see that broot looks for a global .gitignore. I have hidden files hidden in my global .gitignore (in .config/git/ignore). I just commented out that line and it appears this makes broot work as normal. This is unexpected, since I am not operating within a git repo.

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

Yes broot respects the global gititignore. But... is your global gitignore hiding .test_hidden ?

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

(maybe broot shouldn't use the global gitignore out of git repositories)

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

My global .gitignore hides anything which starts with a dot, yes. It also hides files which I would never want committed to a repo, but which I sometimes need to see, e.g. backup files, hidden files, latex debug files, etc. If I ever need to add one of these, I add it manually, which by default overrides the gitignore.

I agree that broot should not hide global gitignore files outside of a git repo.

In addition, I think there still might be a bug here: even when I disable hiding gitignore from within broot and enable hidden files, broot still hides files from my global gitignore until I run the :toggle_git_status command at least once.

@Canop
Copy link
Owner

Canop commented Sep 4, 2020

My global .gitignore hides anything which starts with a dot, yes

But... what about all the files with a dot you should commit (for example the .gitignore) ?

I agree that broot should not hide global gitignore files outside of a git repo.

Yes, I think I'll change that

@mwshinn
Copy link
Author

mwshinn commented Sep 4, 2020

But... what about all the files with a dot you should commit (for example the .gitignore) ?

git add -f .gitignore :)

Yes, I think I'll change that

Thanks for making the change and for your work on broot. I just discovered it through a thread on lobste.rs and it is a really exciting new way to interact with the filesystem on the terminal!

@Canop Canop closed this as completed in 84995c1 Sep 6, 2020
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