git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] legacy stash: fix "rudimentary backport of -q"

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 7, 2019, 15:29 UTC
Message-ID
<f76c7cb66c43a6c4bf712516949a867b09710103.1551972571.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.159.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When this developer backported support for `--quiet` to the scripted version of `git stash` in 80590055ea (stash: optionally use the scripted version again, 2018-12-20), it looked like a sane choice to use `eval` to execute the command line passed in via the parameter list of `maybe_quiet`.

However, that is not what we should have done, as that command-line was already in the correct shape.

This can be seen very clearly when passing arguments with special characters, like

	git stash -- ':(glob)**/*.txt'

Since this is exactly what we want to test in the next commit (where we fix this very incantation with the built-in stash), let's fix the legacy scripted version of `git stash` first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-legacy-stash.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-legacy-stash.sh b/git-legacy-stash.sh
index 8a8c4a9270..f60e9b3e87 100755
--- a/git-legacy-stash.sh
+++ b/git-legacy-stash.sh
@@ -86,17 +86,17 @@ maybe_quiet () {
 		shift
 		if test -n "$GIT_QUIET"
 		then
-			eval "$@" 2>/dev/null
+			"$@" 2>/dev/null
 		else
-			eval "$@"
+			"$@"
 		fi
 		;;
 	*)
 		if test -n "$GIT_QUIET"
 		then
-			eval "$@" >/dev/null 2>&1
+			"$@" >/dev/null 2>&1
 		else
-			eval "$@"
+			"$@"
 		fi
 		;;
 	esac
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 2 of 13 in “stash: handle pathspec magic again”
  1. 0/2 stash: handle pathspec magic againJohannes Schindelin via GitGitGadget, Mar 7, 2019
  2. 1/2 legacy stash: fix "rudimentary backport of -q"Johannes Schindelin via GitGitGadget, Mar 7, 2019
  3. Junio C HamanoMar 11, 2019
  4. 2/2 built-in stash: handle :(glob) pathspecs againJohannes Schindelin via GitGitGadget, Mar 7, 2019
  5. Junio C HamanoMar 11, 2019
  6. Johannes SchindelinMar 11, 2019
  7. Thomas GummererMar 11, 2019
  8. Junio C HamanoMar 8, 2019
  9. Johannes SchindelinMar 8, 2019
  10. Junio C HamanoMar 10, 2019
  11. Johannes SchindelinMar 11, 2019
  12. Junio C HamanoMar 18, 2019
  13. Junio C HamanoMar 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.