!21542 Part 2 & 3: Handle edge cases in stage and unstage mutations
What does this MR do?
Modify stage and unstage mutations to handle edge cases involving the ability to stage empty content in Web IDE. Also handle cases of files deleted and readded.
When staged changes and unstaged changes have exactly the same, but opposite changes, staging or unstaging at that point should cancel each other's change out. This is the default behaviour of git. This may happen by adding a string and then removing it, or by deleting a file competely and adding it back (by creating a new file and pasting its contents).
Current behaviour: On staging/unstaging a file that has equal, but opposite changes in staged and unstaged, an empty changeset is added to staged/unstaged changes respectively.
Expected behavior: There should be no changeset, since the staged and unstaged changes cancel each other out.
This MR uses the getters defined in !21673 (merged).
Does this MR meet the acceptance criteria?
- Changelog entry
- Documentation (if required)
- Code review guidelines
- Merge request performance guidelines
- Style guides
- Database guides
- Separation of EE specific content
Availability and Testing
- Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- Tested in all supported browsers
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
Label as security and @ mention
- The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- Security reports checked/validated by a reviewer from the AppSec team