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

cmd/edit: check if --force-linebreak coming from CLI or config #791

Closed bmeneg closed 2 years ago

bmeneg commented 2 years ago

When --force-linebreak is set through the config file the conditional for opening the editor will always be satisfied no matter what's the other flag being used together, since it only requires NFlag() == 1 and linebreak being set.

For instance:

lab.toml: [mr_edit] force-linebreak = true

cli: $ lab mr edit --ready [EDITOR IS OPENED]

This patch fixes it by checking it linebreak is being actually set through the CLI, so in case NFlag() == 1 we're sure the user wants to open the editor considering the "force-linebreak".

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

Related: #790

codecov[bot] commented 2 years ago

Codecov Report

Merging #791 (1d65256) into master (8ab707a) will decrease coverage by 0.05%. The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
- Coverage   55.07%   55.02%   -0.06%     
==========================================
  Files          77       77              
  Lines        5641     5656      +15     
==========================================
+ Hits         3107     3112       +5     
- Misses       2255     2263       +8     
- Partials      279      281       +2     
Impacted Files Coverage Δ
cmd/issue_edit.go 72.32% <44.44%> (-2.68%) :arrow_down:
cmd/mr_edit.go 61.05% <44.44%> (-1.25%) :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 8ab707a...1d65256. Read the comment docs.