Describe the bug
Recreating a failed PR successfully reuses the title, but not the body of the PR (gh version: 1.7.0).
Steps to reproduce the behavior
- Clone a repository
- Check out a new branch
- Make changes and stage them, but don't create a commit yet
gh pr create and follow the prompts, including adding a body using the editor
- Once the PR creation fails, actually make the commit, and do
gh pr create --recover as instructed by the error message
- When prompted for the title, press Enter to reuse the same title as before
- When prompted for the body, press Enter as well
- Finish the command and submit the PR
Expected vs actual behavior
I expected the same body message that I had used before to be included. Instead, the PR was created with an empty body.
I actually went and opened the json file mentioned in the error message, and to my relief the text I had typed before was there, so I was able to recover the content and paste it into the PR.
I'm not sure this can be classified as a bug — technically, the "skip editor" behavior for the body prompt is the same as when creating a new PR (i.e. the body becomes empty). But being a recovery procedure, it feels wrong not to acknowledge that there's a body text available and simply discard it silently unless one decides to enter the editor. Even then, there's no indication that the editor would be pre-filled with the saved content, so I'd be wary of overwriting the previous content (which is part of the reason why I pressed Enter to skip opening the editor).
Maybe showing an excerpt of the previously written body as a greyed out default for the body text (the same way it is done for the title) could help make this flow predictable.
Logs
For reference, the failure message of the original PR creation was this:
X operation failed. To restore: gh pr create --recover /var/folders/6p/m7980bc100g5q58dc14q7l6h0000gn/T/gh914700270.json`
pull request create failed: GraphQL error: No commits between <upstream>:master and <fork>:<pr-branch>
Describe the bug
Recreating a failed PR successfully reuses the title, but not the body of the PR (gh version:
1.7.0).Steps to reproduce the behavior
gh pr createand follow the prompts, including adding a body using the editorgh pr create --recoveras instructed by the error messageExpected vs actual behavior
I expected the same body message that I had used before to be included. Instead, the PR was created with an empty body.
I actually went and opened the json file mentioned in the error message, and to my relief the text I had typed before was there, so I was able to recover the content and paste it into the PR.
I'm not sure this can be classified as a bug — technically, the "skip editor" behavior for the body prompt is the same as when creating a new PR (i.e. the body becomes empty). But being a recovery procedure, it feels wrong not to acknowledge that there's a body text available and simply discard it silently unless one decides to enter the editor. Even then, there's no indication that the editor would be pre-filled with the saved content, so I'd be wary of overwriting the previous content (which is part of the reason why I pressed Enter to skip opening the editor).
Maybe showing an excerpt of the previously written body as a greyed out default for the body text (the same way it is done for the title) could help make this flow predictable.
Logs
For reference, the failure message of the original PR creation was this: