zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.1k stars 103 forks source link

Fix guessing the MR ID based on the current branch #837

Closed bmeneg closed 2 years ago

bmeneg commented 2 years ago

This PR fixes the lab's "guess" operation for retrieving the MR ID based on the currently checked-out branch, which was, recently, causing issues with the testing code.

Currently, if any MR opened from a forked project but with the same source branch name will get mixed with MRs from the original project with that name, possibly returning the wrong ID to the user.

Check the second commit for more detailed information.

Signed-off-by: Bruno Meneguele bmeneg@redhat.com

bmeneg commented 2 years ago

Unfortunately, I'm not being able to figure out what's going on with the test: why it's failing. Give me a few more hours and I'll have it fixed.

codecov[bot] commented 2 years ago

Codecov Report

Merging #837 (bc998be) into master (5de8e80) will decrease coverage by 0.29%. The diff coverage is 26.31%.

@@            Coverage Diff             @@
##           master     #837      +/-   ##
==========================================
- Coverage   56.17%   55.87%   -0.30%     
==========================================
  Files          77       77              
  Lines        5775     5750      -25     
==========================================
- Hits         3244     3213      -31     
- Misses       2239     2246       +7     
+ Partials      292      291       -1     
Impacted Files Coverage Δ
cmd/util.go 74.15% <ø> (-0.22%) :arrow_down:
internal/gitlab/gitlab.go 8.78% <26.31%> (+1.14%) :arrow_up:
cmd/project_create.go 35.38% <0.00%> (-46.16%) :arrow_down:
cmd/root.go 58.82% <0.00%> (-4.71%) :arrow_down:
cmd/mr_list.go 66.94% <0.00%> (-1.70%) :arrow_down:
cmd/mr_show.go 62.25% <0.00%> (-1.33%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 47b2198...bc998be. Read the comment docs.

bmeneg commented 2 years ago

Ok, I had to add an additional commit to fix a few test cases that were changed due to old bogus tests that left the test repo in a weird state (ie. MRs were opened but not closed)