Skip to content

Conversation

@kapral18
Copy link
Contributor

@kapral18 kapral18 commented Sep 13, 2025

Fixes: #4890

  • Fix file status parsing to handle Git copy operations when status.renames=copies is configured
  • Extend status parser to recognize both "R" (rename) and "C" (copy) prefixes
  • Add comprehensive test coverage for copy status codes

The same issue from #4890
now is fixed

image

@kapral18 kapral18 force-pushed the fix-copy-status-support branch 2 times, most recently from 048fcc8 to 605ab26 Compare October 8, 2025 21:57
@stefanhaller stefanhaller added the bug Something isn't working label Oct 14, 2025
Fixes jesseduffield#4890

When Git is configured with status.renames=copies, it can produce
status codes starting with "C" (copy) in addition to "R" (rename).
The file loader was only checking for "R" prefixes, causing copy
operations to be parsed incorrectly and breaking file staging.

This fix extends the status parser to handle both "R" and "C"
prefixes, ensuring proper support for Git's copy detection feature.

Fixes file staging issues when using status.renames=copies configuration.
@stefanhaller stefanhaller force-pushed the fix-copy-status-support branch from 605ab26 to e6f3313 Compare October 14, 2025 09:57
@stefanhaller
Copy link
Collaborator

Sorry for the long delay in reviewing this. LGTM, thanks for the contribution!

Just one observation because I'm not familiar with git's behavior here: the behavior of git's copy detection seems a little weird to me. It only seems to detect a file as being a copy if the original file also occurs in the diff somehow, either because it was moved (like in the example in #4890), or because it was modified. In other words, if I modify a file foo and then copy it, it shows M foo and C foo -> foo2, but if I then discard the modifications to foo, it says A foo2. I find this hard to understand. Nothing to do with your PR of course.

@stefanhaller stefanhaller merged commit 6b5b493 into jesseduffield:master Oct 14, 2025
12 checks passed
@kapral18 kapral18 deleted the fix-copy-status-support branch October 14, 2025 11:58
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 4, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.55.1` -> `v0.56.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.56.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.56.0)

[Compare Source](jesseduffield/lazygit@v0.55.1...v0.56.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.56.0 -->

#### What's Changed

##### Enhancements 🔥

- Don't break line after footnote symbol in commit messages by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4912](jesseduffield/lazygit#4912)
- Give better visual feedback when checking out the previous branch by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4929](jesseduffield/lazygit#4929)
- Add merge menu with conflict resolver by [@&#8203;lmnek](https://github.com/lmnek) in [#&#8203;4889](jesseduffield/lazygit#4889)
- When entering a commit in path filtering mode, select the filtered path by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4942](jesseduffield/lazygit#4942)
- Document a workaround for using custom pagers on Windows by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4941](jesseduffield/lazygit#4941)
- Show "Log (x of y)" in the title bar when there is more than one branch log command by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4943](jesseduffield/lazygit#4943)
- Support multiple pagers by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4953](jesseduffield/lazygit#4953)
- Add config option gui.skipSwitchWorktreeOnCheckoutWarning by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4964](jesseduffield/lazygit#4964)
- Add no-ff merge option by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4966](jesseduffield/lazygit#4966)

##### Fixes 🔧

- Don't log the git rev-list command that we use for IsBranchMerged by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4896](jesseduffield/lazygit#4896)
- Hide the cursor when the password prompt is showing by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4878](jesseduffield/lazygit#4878)
- Update Merge conflicts menu keybinding to use p instead of k by [@&#8203;zingazzi](https://github.com/zingazzi) in [#&#8203;4934](jesseduffield/lazygit#4934)
- Update diff of conflicted file in the main view after conflicts have been resolved by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4945](jesseduffield/lazygit#4945)
- Don't depend on en\_US locale to be installed by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4949](jesseduffield/lazygit#4949)
- Fix dropping submodule changes from a commit by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4937](jesseduffield/lazygit#4937)
- Fix support for Git copy status when status.renames=copies by [@&#8203;kapral18](https://github.com/kapral18) in [#&#8203;4892](jesseduffield/lazygit#4892)
- When pasting multi-line text into a prompt, don't treat the line feeds as "confirm" by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4955](jesseduffield/lazygit#4955)
- Offer to force-delete a worktree if it contains submodules by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4959](jesseduffield/lazygit#4959)
- Fix window arrangement when a popup or the search prompt is open by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4961](jesseduffield/lazygit#4961)
- Fix lazygit getting unresponsive when pasting commits that become empty by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4958](jesseduffield/lazygit#4958)
- Show a better error message if the temp directory is not writeable by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4968](jesseduffield/lazygit#4968)
- Avoid auto-stashing when only submodules are out of date by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4969](jesseduffield/lazygit#4969)
- Use a PTY when using external diff command from git config by [@&#8203;brandondong](https://github.com/brandondong) in [#&#8203;4983](jesseduffield/lazygit#4983)
- Fix fixup's false filename detection in hunks containing dashed lines by [@&#8203;abobov](https://github.com/abobov) in [#&#8203;5004](jesseduffield/lazygit#5004)

##### Maintenance ⚙️

- Make running with --debug and running integration tests work when built with go 1.25 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4910](jesseduffield/lazygit#4910)
- Update go to 1.25 by [@&#8203;kyu08](https://github.com/kyu08) in [#&#8203;4844](jesseduffield/lazygit#4844)
- feat(nix): add comprehensive Nix flake by [@&#8203;doprz](https://github.com/doprz) in [#&#8203;4826](jesseduffield/lazygit#4826)
- Fix normalisedSelectedNodes function by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4920](jesseduffield/lazygit#4920)
- Add `synchronize` event to the hooks of "Check Required Labels" by [@&#8203;kyu08](https://github.com/kyu08) in [#&#8203;4974](jesseduffield/lazygit#4974)
- Use ignore directive to ignore test files not to be passes to gofumpt by [@&#8203;kyu08](https://github.com/kyu08) in [#&#8203;4936](jesseduffield/lazygit#4936)

##### Docs 📖

- Fix MoveCommitsToNewBranch description typo by [@&#8203;deventon](https://github.com/deventon) in [#&#8203;4867](jesseduffield/lazygit#4867)
- Wrap long lines in comments in Config.md by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;4951](jesseduffield/lazygit#4951)
- Fix keybinding cheatsheets with regard to pipe characters in key or description by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5007](jesseduffield/lazygit#5007)

##### I18n 🌎

- Update translations from Crowdin by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5005](jesseduffield/lazygit#5005)

#### New Contributors

- [@&#8203;deventon](https://github.com/deventon) made their first contribution in [#&#8203;4867](jesseduffield/lazygit#4867)
- [@&#8203;zingazzi](https://github.com/zingazzi) made their first contribution in [#&#8203;4934](jesseduffield/lazygit#4934)
- [@&#8203;doprz](https://github.com/doprz) made their first contribution in [#&#8203;4826](jesseduffield/lazygit#4826)
- [@&#8203;lmnek](https://github.com/lmnek) made their first contribution in [#&#8203;4889](jesseduffield/lazygit#4889)
- [@&#8203;kapral18](https://github.com/kapral18) made their first contribution in [#&#8203;4892](jesseduffield/lazygit#4892)
- [@&#8203;abobov](https://github.com/abobov) made their first contribution in [#&#8203;5004](jesseduffield/lazygit#5004)

**Full Changelog**: <jesseduffield/lazygit@v0.55.1...v0.56.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:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNjkuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE2OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git config status.renames=copies messes up staging

2 participants