fix: Don't add glab-resolved when it already exists in a remote
Description
On every glab mr create --fill command the application adds a glab-resolved head and glab-resolved base entry to your remote. This fills your gitconfig
for no reason. The fix is quite simple. We check if the resolution already
exists in the remote. If it does, we don't add it another time. We cannot do
git config --replace-all remote.<remote>.glab-resolved <value> because that
removes either the head or the base entry.
git config --get-all returns with an exit code of 1 when it cannot find a
key. We therefore check if the output isn't empty to indicate a failure.
Closes: 3461
Signed-off-by: Wesley Schwengle wesleys@opperschaap.net
Related Issues
Resolves #3461 (closed)
How has this been tested?
Manually tested my changes. I've tried to add tests, but they are merely stubs. Perhaps someone has a good idea how to write the tests?
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap