[PR #135] [MERGED] command: fix NewCommand #135

Closed
opened 2026-02-16 10:24:13 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/git/pull/135
Author: @michaelkuhn
Created: 11/27/2018
Status: Merged
Merged: 11/27/2018
Merged by: @lafriks

Base: masterHead: newcommand-append


📝 Commits (1)

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 command.go (+4 -1)

📄 Description

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

My recent PR for Gitea (https://github.com/go-gitea/gitea/pull/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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/git/pull/135 **Author:** [@michaelkuhn](https://github.com/michaelkuhn) **Created:** 11/27/2018 **Status:** ✅ Merged **Merged:** 11/27/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `newcommand-append` --- ### 📝 Commits (1) - [`ad7491d`](https://github.com/go-gitea/git/commit/ad7491de50805bd472fe255496c42e57b1e9e385) command: fix NewCommand ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `command.go` (+4 -1) </details> ### 📄 Description Make an explicit copy of GlobalCommandArgs, otherwise append might overwrite it. My recent PR for Gitea (https://github.com/go-gitea/gitea/pull/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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:24:13 -05:00
yindo closed this issue 2026-02-16 10:24:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: go-gitea/git#135