Fix gitignore path collisions#5245
Conversation
|
I'm a bit undecided about this. I do see the issue, but I have the feeling that in many cases (e.g. for something like |
|
I understand the concern, however I believe the current behavior is the more unintuitive one. Lazygit has a file tree and when selecting what to ignore you have to pick one of the files/directories. Most users would surely expect that they'd be ignoring the selected file (be it in a subdirectory or root), but not creating a new pattern. This could of course be extended at some point to allow you to select Another point is that it's safer to be explicit, current behavior can lead to accidentally uncommited changes. The one I'm trying to introduce leads to minor inconvenience at most (having to add a line manually to |
97671e3 to
5b63c0a
Compare
|
Ok, fair enough. We will probably extend the current gitignore command at some point to show a menu with options to ignore this exact file, or all files with the same extension, or to edit the file, and at that point we can consider if we want to add with/without leading slash options too (but maybe rather not). I added a fixup (5b63c0a) for a minor fix to the comment. |
Paths added to ignore/exclude files need to be prefixed with a forward slash to point to a specific file in the directory tree. Without that prefix a file at root called `file` (added to `.gitignore` as `file`) would match with `./file` and `./src/file`.
5b63c0a to
48a8a71
Compare
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.58.1` → `v0.59.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.59.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.59.0) [Compare Source](jesseduffield/lazygit@v0.58.1...v0.59.0) <!-- Release notes generated using configuration in .github/release.yml at v0.59.0 --> #### What's Changed ##### Enhancements 🔥 - Have "Find base commit for fixup" ignore fixup commits for the found base commit by [@​stefanhaller](https://github.com/stefanhaller) in [#​5210](jesseduffield/lazygit#5210) - Exclude commit trailers from line wrapping by [@​stefanhaller](https://github.com/stefanhaller) in [#​5230](jesseduffield/lazygit#5230) - Limit popup panel widths to a maximum width by [@​stefanhaller](https://github.com/stefanhaller) in [#​5231](jesseduffield/lazygit#5231) - Support using the selected commit's message in a fixup by [@​jesseduffield](https://github.com/jesseduffield) in [#​5233](jesseduffield/lazygit#5233) - Fix gitignore path collisions by [@​DawidPietrykowski](https://github.com/DawidPietrykowski) in [#​5245](jesseduffield/lazygit#5245) ##### Fixes 🔧 - Don't log the "git rev-list" call when marking bisect commits by [@​stefanhaller](https://github.com/stefanhaller) in [#​5236](jesseduffield/lazygit#5236) - Fix opening a menu when a previous menu was scrolled down by [@​stefanhaller](https://github.com/stefanhaller) in [#​5238](jesseduffield/lazygit#5238) - When moving commits up/down and the selection leaves the view, scroll to make it visible again by [@​stefanhaller](https://github.com/stefanhaller) in [#​5247](jesseduffield/lazygit#5247) - Fix rendering of CRLF sequence ('\r\n') by [@​stefanhaller](https://github.com/stefanhaller) in [#​5237](jesseduffield/lazygit#5237) - Fix rendering of the Reflog panel when using up/down to scroll it by [@​stefanhaller](https://github.com/stefanhaller) in [#​5248](jesseduffield/lazygit#5248) - Add Nushell support for nvim-remote preset by [@​baiyeidk](https://github.com/baiyeidk) in [#​5250](jesseduffield/lazygit#5250) ##### Maintenance ⚙️ - Update devcontainer `VARIANT` to `1-trixie` by [@​mricherzhagen](https://github.com/mricherzhagen) in [#​5204](jesseduffield/lazygit#5204) - chore: Update outdated GitHub Actions versions by [@​pgoslatara](https://github.com/pgoslatara) in [#​5220](jesseduffield/lazygit#5220) - Disable the automatic, scheduled release by [@​stefanhaller](https://github.com/stefanhaller) in [#​5272](jesseduffield/lazygit#5272) - Auto-update cheatsheets after updating translation by [@​stefanhaller](https://github.com/stefanhaller) in [#​5275](jesseduffield/lazygit#5275) ##### Docs 📖 - Update README to add GitArbor TUI as an alternative by [@​cadamsdev](https://github.com/cadamsdev) in [#​5257](jesseduffield/lazygit#5257) - Update docs and schema for release by [@​stefanhaller](https://github.com/stefanhaller) in [#​5276](jesseduffield/lazygit#5276) ##### I18n 🌎 - Update translations from Crowdin by [@​stefanhaller](https://github.com/stefanhaller) in [#​5274](jesseduffield/lazygit#5274) #### New Contributors - [@​pgoslatara](https://github.com/pgoslatara) made their first contribution in [#​5220](jesseduffield/lazygit#5220) - [@​cadamsdev](https://github.com/cadamsdev) made their first contribution in [#​5257](jesseduffield/lazygit#5257) - [@​baiyeidk](https://github.com/baiyeidk) made their first contribution in [#​5250](jesseduffield/lazygit#5250) **Full Changelog**: <jesseduffield/lazygit@v0.58.1...v0.59.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Ni4yIiwidXBkYXRlZEluVmVyIjoiNDIuOTYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
PR Description
Paths added to ignore/exclude files need to be prefixed with a forward slash to point to a specific file in the directory tree.
Without that prefix a file at root called
file(added to.gitignoreasfile) would match with./fileand./src/file.Example flow:
testsin rootsrc/testsare now missing - becausetestswithout/matches also directories lower in the treePlease check if the PR fulfills these requirements
go generate ./...)