vscode-pull-request-github
vscode-pull-request-github copied to clipboard
Creating a PR fails with "There has to be a difference in the commits to create a PR"
- Extension version: 0.76.1
- VSCode Version: 1.85.0
- OS: Windows 10 22H2
- Repository Clone Configuration (single repository/fork of an upstream repository): fork of an upstream repository
- Github Product (Github.com/Github Enterprise version x.x.x): github.com
Steps to Reproduce:
- In a fork, create a new branch and make changes and commit some but not everything.
- Upload branch to fork
- Click on create PR
- Fill out PR form
- Submit the form
- A dialog shows up that asks you to commit all uncommitted changes. Click cancel.
- See error message
Can you share a screenshot of the "Create" form after you've filled it out?
Thanks @Thomas1664. I'm still having trouble reproducing the issue. Can you share a screenshot of the dialog that pops up too?
I can even reproduce this in a clean Codespace (although I originally experienced this on my local device). The codespace has version 0.78.1 of this extension. Note that you must have uncommitted changes for this to happen.
I can even reproduce this in a clean Codespace
Does this mean you haven't yet committed?
By "clean" I mean a fresh codespace. As you can see on the first screenshot, there are a few commits. I just didn't commit everything.
I'm still not able to reproduce this issue. Is there some chance that you accidentally made the commits on main before creating a new branch?
No, the commits are on a new branch. I can also confirm that the Codespace doesn't have any git related customized settings.
I think timing is important: I created a new branch, added a few commits and pushed that branch. I created a PR using the command palate a few hours later. Interestingly, I was unable to reproduce the issue.
Therefore, I think it's important to make changes first, then create a new branch and then commit the changes (but not all of them) and finally push that branch. I think the source of the bug is that the extension thinks the new branch doesn't exist on the remote repository.
The modal seems to come from here: https://github.com/microsoft/vscode-pull-request-github/blob/3faacda5af1630da1f009a2f8838e034cf2cd0cf/src/github/folderRepositoryManager.ts#L1420
Next time, I'll try to find something in the logs.
@alexr00 the issue is still reproducible for me.
This time I captured the logs:
2024-01-27 13:19:34.403 [info] Activation> Extension version: 0.78.1
2024-01-27 13:19:35.028 [info] Looking for git repository
2024-01-27 13:19:35.028 [info] Found 0 repositories during activation
2024-01-27 13:19:35.028 [info] Git repository found, initializing review manager and pr tree view.
2024-01-27 13:19:35.036 [info] Registering git provider
2024-01-27 13:19:41.876 [info] Git initialization state changed: state=initialized
2024-01-27 13:19:41.876 [info] Review+0> Validate state in progress
2024-01-27 13:19:41.876 [info] Review+0> Validating state...
2024-01-27 13:19:41.879 [info] Found GitHub remote for folder []
2024-01-27 13:19:42.312 [info] Trying to use globalState for assignableUsers.
2024-01-27 13:19:42.447 [info] Using globalState assignableUsers for 2.
2024-01-27 13:19:42.482 [info] Review+0> Found matching pull request metadata for current branch main. Repo: microsoft/vcpkg PR: 23180
2024-01-27 13:19:42.482 [info] Review+0> current branch main is associated with pull request #23180
2024-01-27 13:19:42.482 [info] Review+0> Resolving pull request
2024-01-27 13:19:42.483 [info] FolderRepositoryManager+0> Found GitHub repo for pr #23180: yes
2024-01-27 13:19:42.933 [info] FolderRepositoryManager+0> Found GitHub pr repo for pr #23180: yes
2024-01-27 13:19:42.933 [info] GitHubRepository> Fetch branch master - enter
2024-01-27 13:19:43.191 [info] GitHubRepository> Fetch branch master - done: true
2024-01-27 13:19:43.197 [info] Review+0> This PR is no longer valid
2024-01-27 13:19:43.197 [info] Review+0> Unable to resolve PR #23180
2024-01-27 13:20:32.631 [error] GitHubRepository> Unable to fetch PR: TypeError: Cannot read properties of undefined (reading 'code')
2024-01-27 13:20:32.631 [info] FolderRepositoryManager+0> Found GitHub repo for pr #34091: yes
2024-01-27 13:20:35.442 [info] FolderRepositoryManager+0> Found GitHub pr repo for pr #34091: yes
2024-01-27 13:20:35.442 [info] GitHubRepository> Fetch branch master - enter
2024-01-27 13:20:35.848 [info] GitHubRepository> Fetch branch master - done: true
2024-01-27 13:23:14.206 [info] Repo state for [] changed.
2024-01-27 13:23:14.206 [info] Repo [] has already been setup.
2024-01-27 14:48:32.302 [info] Review+0> Validate state in progress
2024-01-27 14:48:32.303 [info] Review+0> Validating state...
2024-01-27 14:48:32.314 [info] PullRequestGitHelper> associate open62541 with base branch microsoft/vcpkg#main
2024-01-27 14:48:32.322 [info] Found GitHub remote for folder []
2024-01-27 14:48:32.330 [info] Using in-memory cached assignable users.
2024-01-27 14:48:32.497 [info] Review+0> No matching pull request metadata found locally for current branch open62541
2024-01-27 14:48:32.621 [info] Review+0> Failed to get upstream for branch open62541 from git config.
2024-01-27 14:48:32.628 [info] Review+0> No matching pull request metadata found on GitHub for current branch open62541
2024-01-27 14:49:06.472 [info] Review+0> Validate state in progress
2024-01-27 14:49:06.472 [info] Review+0> Validating state...
2024-01-27 14:49:06.608 [info] Found GitHub remote for folder []
2024-01-27 14:49:06.609 [info] Using in-memory cached assignable users.
2024-01-27 14:49:06.930 [info] Review+0> No matching pull request metadata found locally for current branch open62541
2024-01-27 14:49:07.077 [info] Review+0> Failed to get upstream for branch open62541 from git config.
2024-01-27 14:49:07.078 [info] Review+0> No matching pull request metadata found on GitHub for current branch open62541
2024-01-27 14:49:45.869 [info] Review+0> Validate state in progress
2024-01-27 14:49:45.869 [info] Review+0> Validating state...
2024-01-27 14:49:45.942 [info] Found GitHub remote for folder []
2024-01-27 14:49:45.943 [info] Using in-memory cached assignable users.
2024-01-27 14:49:46.149 [info] Review+0> No matching pull request metadata found locally for current branch open62541
2024-01-27 14:49:46.299 [info] Review+0> Failed to get upstream for branch open62541 from git config.
2024-01-27 14:49:46.299 [info] Review+0> No matching pull request metadata found on GitHub for current branch open62541
2024-01-27 14:49:53.843 [info] Review+0> Validate state in progress
2024-01-27 14:49:53.843 [info] Review+0> Validating state...
2024-01-27 14:49:53.876 [info] Found GitHub remote for folder []
2024-01-27 14:49:53.877 [info] Using in-memory cached assignable users.
2024-01-27 14:49:54.052 [info] Review+0> No matching pull request metadata found locally for current branch open62541
2024-01-27 14:49:54.609 [info] Review+0> No matching pull request metadata found on GitHub for current branch open62541
2024-01-27 14:50:04.409 [error] GitHubRepository> Unable to compare commits between microsoft:main and Thomas1664:open62541: HttpError: Not Found
2024-01-27 14:50:05.839 [info] CreatePullRequestViewProvider> Initializing "create" view: {"defaultBaseRemote":{"owner":"microsoft","repositoryName":"vcpkg"},"defaultBaseBranch":"main","defaultCompareRemote":{"owner":"Thomas1664","repositoryName":"vcpkg"},"defaultCompareBranch":"open62541","defaultTitle":"version","defaultDescription":"","baseHasMergeQueue":false,"remoteCount":2,"allowAutoMerge":false,"mergeMethodsAvailability":{"merge":false,"squash":false,"rebase":false},"autoMergeDefault":false,"createError":"","labels":[],"isDraftDefault":false,"isDarkTheme":true,"generateTitleAndDescriptionTitle":"Generieren mit Copilot","creating":false,"initializeWithGeneratedTitleAndDescription":false}
2024-01-27 14:50:08.805 [error] GitHubRepository> Unable to compare commits between microsoft:main and Thomas1664:open62541: HttpError: Not Found
2024-01-27 14:50:10.725 [info] CreatePullRequestViewProvider> Initializing "create" view: {"defaultBaseRemote":{"owner":"microsoft","repositoryName":"vcpkg"},"defaultBaseBranch":"main","defaultCompareRemote":{"owner":"Thomas1664","repositoryName":"vcpkg"},"defaultCompareBranch":"open62541","defaultTitle":"version","defaultDescription":"","baseHasMergeQueue":false,"remoteCount":2,"allowAutoMerge":false,"mergeMethodsAvailability":{"merge":false,"squash":false,"rebase":false},"autoMergeDefault":false,"createError":"","labels":[],"isDraftDefault":false,"isDarkTheme":true,"generateTitleAndDescriptionTitle":"Generieren mit Copilot","creating":false,"initializeWithGeneratedTitleAndDescription":false}
2024-01-27 14:50:26.927 [error] GitHubRepository> Unable to create PR: Error: GraphQL error: Head sha can't be blank, Base sha can't be blank, No commits between microsoft:main and Thomas1664:open62541, Base ref must be a branch