Conversation
|
🧙 Sourcery has finished reviewing your pull request! Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
This PR adds custom commands for the Fork Git client to streamline common multi-remote operations. The configuration enables developers to manage branches and synchronize code across three Git remotes (origin, gitcode.com, and gitee.com) through convenient custom commands.
Key Changes
- Adds a new
.fork/custom-commands.jsonconfiguration file with three custom commands: "Delete All", "Fetch All", and "Push All" - Enables batch operations across multiple remote repositories (origin, gitcode.com, gitee.com)
- Automates common workflows for branch deletion, fetching, and pushing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| { | ||
| "action" : { | ||
| "script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose", |
There was a problem hiding this comment.
With showOutput set to false and --verbose flags in the git commands, the verbose output won't be visible to users. Either remove the --verbose flags since the output is hidden, or set showOutput to true to make the verbose output useful.
| "script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose", | |
| "script" : "git push origin refs/heads/${ref}\ngit push gitcode.com refs/heads/${ref}\ngit push gitee.com refs/heads/${ref}", |
| }, | ||
| { | ||
| "action" : { | ||
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}", |
There was a problem hiding this comment.
The "Delete All" command chains multiple destructive git operations without error handling. If any of the remote delete operations fail (e.g., remote doesn't exist or branch not found), the subsequent commands will still execute, potentially leading to unexpected behavior. Consider adding error handling or splitting this into separate commands for better control and feedback.
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}", | |
| "script" : "git push gitcode.com --delete refs/heads/${ref} || { echo 'Failed to delete branch ${ref} from gitcode.com'; exit 1; }\ngit push gitee.com --delete refs/heads/${ref} || { echo 'Failed to delete branch ${ref} from gitee.com'; exit 1; }\ngit checkout main || { echo 'Failed to checkout main'; exit 1; }\ngit branch --delete --force ${ref} || { echo 'Failed to delete local branch ${ref}'; exit 1; }", |
| }, | ||
| { | ||
| "action" : { | ||
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}", |
There was a problem hiding this comment.
Using git branch --delete --force is potentially dangerous as it will delete the local branch even if it contains unmerged changes. Consider using --delete without --force to prevent accidental loss of work, or add a confirmation prompt before executing this destructive operation.
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}", | |
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete ${ref}", |
| { | ||
| "action" : { | ||
| "script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}", | ||
| "showOutput" : false, |
There was a problem hiding this comment.
With showOutput set to false, users won't see error messages if any of the destructive delete operations fail. This can lead to confusion about whether the operations succeeded or failed. Consider setting this to true for better user feedback, especially for destructive operations.
| "showOutput" : false, | |
| "showOutput" : true, |
| { | ||
| "action" : { | ||
| "script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose", | ||
| "showOutput" : false, |
There was a problem hiding this comment.
The "Push All" command chains multiple push operations without error handling. If one push fails (e.g., network issues, authentication problems), subsequent pushes will still be attempted but the user may not be aware of the failure since showOutput is false. Consider enabling output visibility or adding error handling between commands.
| "showOutput" : false, | |
| "showOutput" : true, |
Link issues
fixes #716
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Chores: