Skip to content

Incorrect handling of git "copied" status #4927

@gabriellanata

Description

@gabriellanata

Describe the bug

When Git detects a file as "copied" (e.g., copied: original.txt -> copied.txt), lazygit incorrectly displays the status with broken/truncated filenames. Instead of showing the copy relationship properly, it displays garbled text like:

 C   copied.txt
 or  ginal.txt      <--
 M   original.txt

The line "or ginal.txt" appears to be a truncation of "original.txt" from the
copy arrow notation (original.txt -> copied.txt).

To Reproduce

  1. Create a git repository with the following script:
git init
git config user.name "Test User"
git config user.email "test@example.com"
printf 'content line\n%.0s' {1..30} > original.txt
git add original.txt
git commit -m "Initial commit"
cp original.txt copied.txt
echo "new line" >> original.txt
git add -A
  1. Run git status to verify the copied status appears correctly:
Changes to be committed:
    copied:     original.txt -> copied.txt
    modified:   original.txt
  1. Open lazygit in the repository
  2. Observe the Files panel showing the garbled status

Expected behavior

lazygit should properly display the copied file status or treat it as a new file

Screenshots

Image

Version info:

  • commit=, build date=, build source=Homebrew, version=0.55.1, os=darwin, arch=arm64, git version=2.49.0
  • git version 2.49.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions