Skip to content

Conversation

mckaydavis
Copy link
Contributor

Summary

This PR makes stack-pr submit exit early if the tree is in the middle of a git rebase operation.

Problem

stack-pr submit on a repository that is in the middle of a rebase will partially complete then error out.

Context: I had used git rebase to modify some old commits and forgot to do the final git rebase --continue. I then then ran stack-pr submit. It will look like it is working until erroring out with a non-helpful traceback:

Updating commit messages with stack metadata
Updating remote branches
Adding cross-links to PRs
Rebasing the original branch 'HEAD'
Exitcode: 128
Stdout: None
Stderr: None
Traceback (most recent call last):
  File "/Users/mdavis/git/main/.derived/autovenv/exposed-bin/stack-pr", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/mdavis/git/main/.derived/autovenv/lib/python3.11/site-packages/stack_pr/cli.py", line 1401, in main
    command_submit(
  File "/Users/mdavis/git/main/.derived/autovenv/lib/python3.11/site-packages/stack_pr/cli.py", line 951, in command_submit
    run_shell_command(
  File "/Users/mdavis/git/main/.derived/autovenv/lib/python3.11/site-packages/stack_pr/shell_commands.py", line 42, in run_shell_command
    return subprocess.run(list(map(str, cmd)), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'rebase', 'mckaydavis/stack/15', 'HEAD', '--committer-date-is-author-date']' returned non-zero exit status 128.

Copy link

@atomicapple0 atomicapple0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks clean.

@dlumma dlumma merged commit f0cb20f into modular:main Jun 27, 2025
2 checks passed
@mckaydavis mckaydavis deleted the dont-submit-during-rebase branch June 27, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants