This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Staged changes are incorrect when amending in a single-commit repo #1303
Open
Description
repository.getStagedChangesSinceParentCommit()
and repository.getFilePatchForPath()
don't correctly handle the case when HEAD~
does not exist due to the repo having only one commit.
Ideally we redesign the way users modify their most recent commit and this problem goes away entirely.
Repro steps:
- Create repo with a single commit that commits
file1.txt
- Add a new line to
file1.txt
and stage changes - Click on
file1.txt
in the staged changes list to view its diff - Click the amend check box
Expected: Staged changes list shows file1.txt
. Diff view for file1.txt
shows all lines as added
Actual: Staged changes list shows "no changes". Diff view does not update. Console shows fatal: bad revision 'HEAD~'