drewdeponte / git-ps

Patch Stack workflow CLI extension for Git
MIT License
50 stars 4 forks source link

Was able to publish a patch without requesting a review first. #62

Open RyanHedges opened 2 years ago

RyanHedges commented 2 years ago

I was able to pub a patch without it having an obvious corresponding review.

I had two patches, where patch id 1 had a review requested. I meant to publish 1 but typed 0 accidentally. the below output was done after performing a pull and a new rr 1. In the output below you'll see a gps which is my alias for git-ps command. I'm on v1.1.1. I did a couple test on a clean repo and I haven't been able to reproduce. making two commits and trying to pub one that doesn't have a requested review fails to publish as expected. I'm unsure of the commands ran before this happened but I'm sure there were rebases, pulls, and publishing of other patches.

Console output ``` $ gps ls 3.0.2 Fri 21 :clock2: 11:21:47 1 rr 221f36 Fix bug with black avatars on heatmap page 0 13058d Move reset view control to its own component ~/projects/prism-labs/poc-website main 221f368 $ gps pub 0 3.0.2 Fri 21 :clock2: 11:21:50 - found .git dir - /Users/hedges/projects/prism-labs/poc-website/.git - loaded request review state repository - fetched patch at index - 0 - verified no uncommited changes are present - identified originating branch - main - parsed patch id (30461F14-AF9D-430E-8AC6-31E8E9C84E0B) out of commit description - failed to find record in request review state repository for id - 30461F14-AF9D-430E-8AC6-31E8E9C84E0B - generated slug based branch name - ps/rr/move_reset_view_control_to_its_own_component - found upstream branch - origin/main - fetched main - created branch (ps/rr/move_reset_view_control_to_its_own_component) on (origin/main) - checked out ps/rr/move_reset_view_control_to_its_own_component - cherry picking commit - 13058deb55afa0dcf8697bdd63927e31ecd4bf84 - successfully cherry picked commit - 13058deb55afa0dcf8697bdd63927e31ecd4bf84 to 5e52d641cc1161312ae9f046f3ef1f8187ab3c94 - force pushed ps/rr/move_reset_view_control_to_its_own_component up to origin - recorded patch id, branch name, and commit sha association in request review state repository - checked out main so you are where you started ~/projects/prism-labs/poc-website main 221f368 $ gps ls 3.0.2 Fri 21 :clock2: 11:22:01 1 rr 221f36 Fix bug with black avatars on heatmap page 0 p 13058d Move reset view control to its own component ```
drewdeponte commented 2 years ago

This should have prevented you from doing this as that patch had never had a review requested.

There must a bug with the enforcement of that rule or something. But that is the intended behavior and the -f switch is intended to force the pub even if you have never requested review for that patch.

drewdeponte commented 2 years ago

@RyanHedges I just tested this on my machine with a recent patch and it worked correctly. What version of git-ps are you using?

See output from command line with my test.

~/code/uptech/pullwalla-macos
✔ git ps ls                                                                                                                                                                                                                    1m main 01f7aa5
  0     01f7aa Port Create Comment to composable architecture

~/code/uptech/pullwalla-macos
✔ git ps pub 0                                                                                                                                                                                                                 1m main 01f7aa5
- found .git dir - /Users/adeponte/code/uptech/pullwalla-macos/.git
- loaded request review state repository
- fetched patch at index - 0
- verified no uncommited changes are present
- identified originating branch - main
Looks like you haven't requested review for this patch yet. Please do so before publishing. If you want to publish without requesting review use 'git-ps pub -f'.

~/code/uptech/pullwalla-macos
✔ git-ps --version                                                                                                                                                                                                             1m main 01f7aa5
v1.1.1
RyanHedges commented 2 years ago

@drewdeponte v1.1.1. I tried reproducing without any luck before creating this issue. I had the same results you posted.

drewdeponte commented 2 years ago

@RyanHedges so are you saying the behavior is inconsistent?

RyanHedges commented 2 years ago

@drewdeponte Yes, the behavior appears to be inconsistent.