Raise error when git command fails
What does this MR do and why?
Describe in detail what your merge request does and why.
Content
- Raise error when git command fails
This code update enhances the error handling and retry mechanisms for interacting with remote Git repositories. It introduces a new context for the Retriable gem, specifically for Git operations, to better handle connection errors. Additionally, it improves the error messages and status reporting for Git commands, making it easier for developers to debug and troubleshoot issues.
- Create two new error classes
CannotPushErrorandRemoteConnectionError. - Instead of failing silently,
pushmethod raisesCannotPushError - Some improvements to
self.run_git:- Detect connection errors.
- In case of connection errors, use
Retriableto overcome intermittent network or server issues. - Otherwise, return
cmd_outputandresponse_status, same as the moment, to let the caller decides what to do next.
- Add a new
Retriablecontext namedgit. - Add corresponding rspec tests.
- Remove unused
OutOfSyncErrorclass. - Small updates/corrections to README.
Edited by Dat Tang