lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Allow more than one argument in git.merging.args config

Open stefanhaller opened this issue 1 year ago • 3 comments

  • PR Description

Fix a bug where merging would fail with an error message when you try to put more than one argument in the git.merging.args config. This broke with 25f8b0337e.

Fixes #3334.

  • Please check if the PR fulfills these requirements
  • [x] Cheatsheets are up-to-date (run go generate ./...)
  • [x] Code has been formatted (see here)
  • [x] Tests have been added/updated (see here for the integration test guide)
  • [ ] Text is internationalised (see here)
  • [ ] Docs (specifically docs/Config.md) have been updated if necessary
  • [x] You've read through your own file changes for silly mistakes etc

stefanhaller avatar Feb 23 '24 15:02 stefanhaller

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.00% (target: -2.00%) :white_check_mark: 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ee5533f9bf101e2ac313f9c0c41b280fb20d967c) 48410 40569 83.80%
Head commit (253a0096f91fc100261030e591a1035b7efefc62) 48410 (+0) 40567 (-2) 83.80% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3336) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

codacy-production[bot] avatar Feb 23 '24 15:02 codacy-production[bot]

  • [x] Verified bug exists
  • [x] Verified that PR fixes it
  • [x] Looked over the code

About this fix breaking configs with spaces in the git.merging.args field: I looked through the options that git merge can take. The -m <msg> seems like something that's not too exotic that some people might be using. I tried experimenting with changing the args field to a slice of strings, but at first glance, there doesn't seem to be a simple way to do it without breaking everyone's configs. If someone raises another issue about this, we can consider adding a new field called argsList to git.merging, that takes a collection of strings.

Other than that though, LGTM :+1:

karimkhaleel avatar Feb 24 '24 00:02 karimkhaleel

I'm not too worried about -m, it seems very unlikely to me to be used here (it would cause all merge commits to get the same message, why would anybody want that?).

It didn't even occur to me that we could use an array of strings, I agree that this would be the cleanest solution. However, I also agree it's not worth the hassle to think about migrating to it, and it would also make it slightly less intuitive for people who only need to pass a single option, so I'd stay with the current solution, I think it's good enough in practice.

Thanks for the review!

stefanhaller avatar Feb 24 '24 08:02 stefanhaller

Agreed about not having to worry about -m, LGTM!

mark2185 avatar Feb 27 '24 07:02 mark2185