Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

command: fix NewCommand #135

Merged
merged 1 commit into from
Nov 27, 2018
Merged

command: fix NewCommand #135

merged 1 commit into from
Nov 27, 2018

Conversation

michaelkuhn
Copy link

Make an explicit copy of GlobalCommandArgs, otherwise append might overwrite it.

My recent PR for Gitea (go-gitea/gitea#5367) exposed a bug that caused wrong commands to be executed:

[...ules/context/repo.go:364 func1()] [E] GetTags: exit status 129 - error: unknown option `sort=-v:refname'
usage: git cat-file (-t [--allow-unknown-type] | -s [--allow-unknown-type] | -e | -p | <type> | --textconv | --filters) [--path=<path>] <object>

(--sort is an argument for tag, not for cat-file.)

The problem seems to be that GlobalCommandArgs is changed by append, which triggers this behavior.

Make an explicit copy of GlobalCommandArgs, otherwise append might
overwrite it.
@codecov-io
Copy link

codecov-io commented Nov 27, 2018

Codecov Report

Merging #135 into master will increase coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #135      +/-   ##
==========================================
+ Coverage    32.9%   33.01%   +0.11%     
==========================================
  Files          28       28              
  Lines        1781     1784       +3     
==========================================
+ Hits          586      589       +3     
  Misses       1118     1118              
  Partials       77       77
Impacted Files Coverage Δ
command.go 86.56% <100%> (+0.62%) ⬆️

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 6b81917...ad7491d. Read the comment docs.

@lafriks lafriks merged commit 389d3c8 into go-gitea:master Nov 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants