Skip to content

Conversation

@jozef-mokry
Copy link
Contributor

This PR adds a new flag checkForCommitsFromOthers that when enabled (false by default) will check if the last commit on the PR is from the same committer as that of the local commit.

This is useful for scenarios when either multiple people collaborate on the same PR, or when the CI is set up such that it automatically adds a code formatting commit if needed. Currently in such scenarios it is very easy to run spr diff and lose all of the work from others that was added to the PR since you ran spr diff the last time.

Test Plan:
I tried running spr diff in a repo where CI automatically pushes a commit to fix code formatting. The check was triggered. The first time I followed the instructions with git merge, the second time I typed "yes".
(In my test case the git merge did not actually work because the the automated CI commit was just removing the trailing whitespace I added in my test PR, thus making the whole PR empty. Therefore the git merge locally did not trigger a merge conflict, nor did it remove the whitespace I had in my local commit. Maybe a different merge strategy is needed? Or maybe the extra commits from the PR branch need to be squash-rebased into the local commit? Open to suggestions)

This PR adds a new flag `checkForCommitsFromOthers` that when enabled
(false by default) will check if the last commit on the PR is from the
same committer as that of the local commit.

This is useful for scenarios when either multiple people collaborate on
the same PR, or when the CI is set up such that it automatically adds a
code formatting commit if needed. Currently in such scenarios it is very
easy to run `spr diff` and lose all of the work from others that was
added to the PR since you ran `spr diff` the last time.

Test Plan:
I tried running `spr diff` in a repo where CI automatically pushes a
commit to fix code formatting. The check was triggered. The first time I
followed the instructions with `git merge`, the second time I typed
"yes".
(In my test case the `git merge` did not actually work because the
the automated CI commit was just removing the trailing whitespace I
added in my test PR, thus making the whole PR empty. Therefore the `git
merge` locally did not trigger a merge conflict, nor did it remove the
whitespace I had in my local commit. Maybe a different merge strategy is
needed? Or maybe the extra commits from the PR branch need to be
squash-rebased into the local commit? Open to suggestions)
@jozef-mokry jozef-mokry marked this pull request as ready for review October 8, 2025 07:38
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.

2 participants