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(file_controller): Add support for to exclude file by adding them to .git/info/exclude
#2016
Conversation
.git/info/exclude
Thanks for making this @gozes. Instead of having two separate keybindings, I would instead stick to the original keybinding of lowercase 'i' but have it open a menu where the user can choose whether they want to 'ignore' the file or 'exclude' it. There's two three main reasons for this:
The menu itself can have a keybinding of 'i' for ignore and 'e' for exclude so that the lazygit pros can just type 'ie' to exclude a file and 'ii' to ignore. We'll probably need to update an integration test accordingly but I can help out if you need for that. |
@jesseduffield I do think that having What do you think think? @mark2185 thoughts? |
I'm with @jesseduffield on this one, any chance of saving up keyboard real-estate is too good to pass. Maybe there really are only two options, save to And maybe there's something that will fit In short - I vote for having a menu. |
Ok then menu it's. @mark2185 , can you or @jesseduffield point me at some part of the codebase where we do something similar so I can use it as a guide. :) @jesseduffield would definitely appreciate some help with the integration test :) |
@gozes I can give you this, it's a PR that added a menu with two options, which is exactly what we need here :) As for integration tests, the To run the integration tests, |
@mark2185 thanks for that :) I have a look when I get back to my laptop. |
Ok got the menu working. Just traying to sort out the integration test now :) |
@mark2185 @jesseduffield ok, Menu and its integration test done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some feedback. We should also have an integration test for excluding a file, and I'd also add a test for trying to exclude the .gitignore file (as I believe as this PR stands there's currently a bug around that due to checkTracking
not returning a bool)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, couple more things
@gozes nice work. Code looks good, but we've got some failing CI steps |
@jesseduffield I have fixed the linter and cheatsheet errors. However, I'm having a hard time debugging the falling test because if I run |
Ok, so I had a second look at this, aside from intentionally breaking the code to make the test fail, I can't really get them to fail locally. @mark2185 @jesseduffield any ideas what maybe be going on here? How come they fail in Ci but pass fine locally? I have missed something? feels like I have. |
@gozes When running these tests locally they're intermittently failing. When they fail, the snapshot they produce is actually a snapshot of the lazygit repo itself rather than the test repo. CI is doing the same thing. I'm not sure why that's happening but I'd try adding:
to each setup.sh file for the sake of consistency with other tests, and see if that does the trick. I can't see any other reason why the tests would be failing in the way they are. |
@jesseduffield done, let hope that will fix it in ci :) |
@jesseduffield nop look like that didn’t do the trick 😭 |
@gozes By setting the user parameters before initializing the repo actually sets them for the parent repo, not for the newly created repo (submodule, basically). Try moving said lines below |
@gozes dang. New theory: I've noticed that when we have a .gitignore file in a repo snapshot it actually applies to the parent lazygit repo. That is: we have I've got a PR up to see if my theory is right: #2027 If that passes we can merge it all together |
Damn that didn't fix it. Still good to have anyway! |
Also that PR applies @mark2185 's suggestion |
Any other ideas? |
The problem is that we're trying to take a snapshot of the 'actual' repo and the 'expected' repo but it seems like we don't actually have a .git directory in one of them so the snapshot ends up dealing with the entire parent lazygit repo. My current suspicion is that somewhere along the line something is failing but we're ignoring the error. BTW all this happens in BTW the .git_keep thing is actually the .git directory just renamed because git refuses to track any subdirectories named .git. There's a step to convert it from .git_keep to .git before taking the snapshot. Maybe that's failing. |
So turns out we actually did need to create an initial commit. Very strange. At any rate, my PR is passing now so @gozes I'm gonna squash your commits on that into one and then I'll merge it |
closing in favour of #2027 (though this PR did all the work ;) ) |
Awesome work on your first PR @gozes ! |
@jesseduffield thanks. Looking forward to |
This PR will add support to use
I
to add a file the in the repo to.git/info/exclude
fileCloses: #2014