Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a feature to prompt users to push unpushed commits before creating a pull request. When a user attempts to create a PR and their local branch has commits that haven't been pushed to the upstream remote, they are now presented with a modal dialog offering three options: push the commits, continue without pushing, or cancel the PR creation.
Changes:
- Added fetch operation to get accurate ahead/behind count before PR creation
- Added check for unpushed commits with user prompt
- Added push operation when user chooses to push commits before creating PR
Comments suppressed due to low confidence (1)
src/github/createPRViewProvider.ts:1406
- The push operation should have explicit error handling. If the push fails (e.g., due to network issues, permission problems, or conflicting changes on the remote), the error will bubble up to the catch block at line 1477, but this might provide unclear feedback to the user. Consider wrapping the push operation in a try-catch block to provide specific error messaging for push failures and allow the user to decide whether to retry, continue without pushing, or cancel the PR creation.
await this._folderRepositoryManager.repository.push(compareBranch.upstream.remote, compareBranchName);
| // Fetch upstream to get accurate ahead/behind count | ||
| if (compareBranch.upstream) { | ||
| await this._folderRepositoryManager.repository.fetch(compareBranch.upstream.remote, compareBranch.upstream.name); | ||
| // Re-fetch branch info after fetch to get accurate ahead count | ||
| compareBranch = await this._folderRepositoryManager.repository.getBranch(compareBranchName); | ||
| } |
There was a problem hiding this comment.
The fetch operation should be wrapped in error handling. Other fetch operations in the codebase (e.g., in folderRepositoryManager.ts:checkBranchUpToDate) handle potential errors such as deleted remote refs or connection issues. Consider adding try-catch error handling around this fetch operation to gracefully handle scenarios where the upstream remote might be unavailable or deleted.
This issue also appears in the following locations of the same file:
- line 1406
No description provided.