Skip to content

fix: Fix commit action when can't obtain commit difference

[WebIde][Bug]Can't commit changes to empty project (#523 - closed)

What does this MR do and why?

This change improves how the code handles force commits (overwriting existing work) in a version control system. Previously, the system would always try to check how many commits would be overwritten, but if that check failed, it would show an error and stop the commit entirely.

Now, the system is more resilient - it only checks for commit differences when actually needed (during force commits), and if the check fails for any reason, it assumes there's at least 1 commit that could be overwritten and continues with a warning dialog. This prevents users from getting stuck when the commit difference calculation has issues, while still providing appropriate warnings about potentially destructive actions.

The code also adds a safety check to handle cases where there's no commit history (empty SHA), returning 0 commits in those situations without making unnecessary network calls.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

The following video demonstrates that after this fix, the Web IDE can commit and push changes in blank projects.

Screen Recording 2025-09-25 at 11.36.00.mov

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Enrique Alcántara

Merge request reports

Loading