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.11k stars 102 forks source link

mr_show: fix base SHA on git-show due to merged MRs #831

Closed bmeneg closed 2 years ago

bmeneg commented 2 years ago

For open merge-requests the "git-show" command ranging from the

/ to the head MR commit is fine, but once the MR is merged, the diff will be empty, since the code is present in /. The user should be able to call `lab mr show -p` and see the patches of that MR regardless it being merged or not, like it's possible through the WebUI. This patch fixes it by using the merge-request base commit SHA instead of the target-branch. The MR base SHA points to the parent commit of the first commit in the MR, meaning that it'll be always a valid SHA on the target-branch. The head SHA will be kept the same: "mr.SHA". Signed-off-by: Bruno Meneguele
bmeneg commented 2 years ago

Being honest, I'm not sure why the test is failing. Running it manually just works. 🤦

bmeneg commented 2 years ago

Things are getting worse and worse:

--- FAIL: Test_ciStatus (0.58s)
ci_status_test.go:18: Connection to gitlab.com closed by remote host.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
ci_status_test.go:19: exit status 128

🤦

bmeneg commented 2 years ago

Had enough for today:

--- FAIL: Test_snippetCreate (1.36s)
    snippet_create_test.go:37: 2022/05/04 14:27:57 ERROR: snippet_create.go:109: failed to create snippet: POST https://gitlab.com/api/v4/projects/lab-testing/test/snippets: 400 {message: {error: Repository Error creating the snippet}}
codecov[bot] commented 2 years ago

Codecov Report

Merging #831 (5de8e80) into master (702d632) will decrease coverage by 0.06%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #831      +/-   ##
==========================================
- Coverage   56.24%   56.17%   -0.07%     
==========================================
  Files          77       77              
  Lines        5775     5775              
==========================================
- Hits         3248     3244       -4     
- Misses       2236     2239       +3     
- Partials      291      292       +1     
Impacted Files Coverage Δ
cmd/mr_show.go 63.57% <100.00%> (ø)
cmd/fork.go 57.89% <0.00%> (-5.27%) :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 702d632...5de8e80. Read the comment docs.