Skip to content

Incorrect status shown when rebasing with deleted/renamed files #351

@spookylukey

Description

@spookylukey

When rebasing and merge conflicts arise, edamagit shows incorrect status if any files have been deleted or renamed (and possibly other situations).

Steps to reproduce

Start with repo where have a README file on master, and 2 branches:

  • in delete_readme, we delete the README
  • in modify_readme, we modify it

This can be created from an empty dir as follows:

git init                                                                                                                                                                                                                  echo "Hello" > README.txt
git add README.txt
git commit -m "README"
git checkout -b delete_readme
git rm README.txt
git commit -m "Deleted README"
git checkout master
git checkout -b modify_readme
echo 'Another line' >> README.txt
git add README.txt
git commit -m "Modified README"

Now, from edamagit in VS Code, starting at the modify_readme branch, do a rebase elsewhere (r e) onto delete_readme branch.

Expected outcome

The rebase should stop at the merge conflict, and the status window should show the README.txt file as deleted by us. This is what git status shows:

interactive rebase in progress; onto 669782f
Last command done (1 command done):
   pick 979c47f Modified README
No commands remaining.
You are currently rebasing branch 'modify_readme' on '669782f'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   README.txt

no changes added to commit (use "git add" and/or "git commit -a")
 and it is what magit shows.

("deleted by us" is the somewhat confusing behaviour of git, but it is what it is)

Magit shows the same:

Head:     669782f Deleted README

Rebasing modify_readme onto delete_readme
join 979c47f Modified README
onto 669782f Deleted README

Staged changes (1)
unmerged   README.txt (deleted by us)

Recent commits
669782f @ delete_readme Deleted README
95cc4df master README

Actual outcome

Instead of deleted by us, edamagit shows both added.

Output in edamagit status window:

Head:     669782f Deleted README

Rebasing modify_readme onto delete_readme
join 979c47f Modified README
onto 669782f Deleted README

Unstaged changes (1)
unmerged   README.txt (both added)

Recent commits
669782f delete_readme Deleted README
95cc4df master README

Similar things happen with all operations that delete or rename files - sometimes you get both deleted etc, but it doesn't match git status or magit, and it is obviously incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions