Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't erase commit message when commit fails #836

Closed
fcollonval opened this issue Nov 30, 2020 · 1 comment · Fixed by #971
Closed

Don't erase commit message when commit fails #836

fcollonval opened this issue Nov 30, 2020 · 1 comment · Fixed by #971
Labels
enhancement Good first issue Good first issue to be tackled by new contributors pkg:Frontend

Comments

@fcollonval
Copy link
Member

When using git hook (for example such as black), it may happen that the commit is rejected. Unfortunately in case of error the commit message is erased. It would be nice to keep it as the user will want to carry small correction (like add the black format correction) before retrying to commit.

@fcollonval fcollonval added enhancement pkg:Frontend Good first issue Good first issue to be tackled by new contributors labels Nov 30, 2020
@krassowski
Copy link
Member

The relevant code is in:

private _onCommitSubmit = (): void => {
const msg = this.state.summary + '\n\n' + this.state.description + '\n';
this.props.onCommit(msg);
// NOTE: we assume here that committing changes always works and we can safely clear component state
this._reset();
};

The _reset() should only be called upon successful completion of the promise returned by onCommit(msg).

navn-r added a commit to MLH-Fellowship/jupyterlab-git that referenced this issue Jul 6, 2021
navn-r added a commit to MLH-Fellowship/jupyterlab-git that referenced this issue Jul 6, 2021
navn-r added a commit to MLH-Fellowship/jupyterlab-git that referenced this issue Jul 7, 2021
…jupyterlab#836)

- Raise error instead of returning false on fail setting identity
fcollonval pushed a commit that referenced this issue Jul 8, 2021
… (#971)

* Move commit message state to git panel (#931)

* Preserve commit message when commit fails (#836)

* Fix unit tests from refactor (#931) (#836)

* Rename commit message state variables (#931)

* summary -> commitSummary
* description -> commitDescription

* Preserve commit message when refusing to set identity when committing (#836)

- Raise error instead of returning false on fail setting identity

* Refactor commit and commit message handler functions

* GitPanel.commitFiles now handles all commit actions
* Refactor GitPanel spec to test commitFiles function instead of commitStaged
* Change commit message handler functions to be more generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Good first issue Good first issue to be tackled by new contributors pkg:Frontend
Projects
None yet
2 participants