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

[PATCH] commit: correctly escape @ of stashes

From
MGMartin Bektchiev via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 3, 2020, 09:30 UTC
Message-ID
<pull.815.git.git.1593768655179.gitgitgadget@gmail.com>
From: Martin Bektchiev <martin.bektchiev@progress.com>

Autocomplete suggestions for stashes are broken due to `stash@` being suggested without escaping.

Reproducible on `GNU bash, version 3.2.57(1)-release` and `macOS Catalina 10.15.5`.

Signed-off-by: Martin Bektchiev <martin.bektchiev@progress.com>
---
    Correctly escape @ of stashes
    
    Autocomplete suggestions for stashes are broken due to stash@being
    suggested without escaping.
    
    Reproducible on GNU bash, version 3.2.57(1)-release
    (x86_64-apple-darwin19)and macOS Catalina 10.15.5.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-815%2Fmbektchiev%2Fpatch-1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-815/mbektchiev/patch-1-v1
Pull-Request: https://github.com/git/git/pull/815
 contrib/completion/git-completion.bash | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index de5d0fbbd1..986a7352ef 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2999,12 +2999,14 @@ _git_stash ()
 				__git_complete_refs
 			else
 				__gitcomp_nl "$(__git stash list \
-						| sed -n -e 's/:.*//p')"
+						| sed -n -e 's/:.*//p' \
+						| sed 's/@/\\@/')"
 			fi
 			;;
 		show,*|apply,*|drop,*|pop,*)
 			__gitcomp_nl "$(__git stash list \
-					| sed -n -e 's/:.*//p')"
+					| sed -n -e 's/:.*//p' \
+					| sed 's/@/\\@/')"
 			;;
 		*)
 			;;

base-commit: a08a83db2bf27f015bec9a435f6d73e223c21c5e
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 5 in “commit: correctly escape @ of stashes”
  1. commit: correctly escape @ of stashesMartin Bektchiev via GitGitGadget, Jul 3, 2020
  2. Junio C HamanoJul 6, 2020
  3. Johannes SchindelinJul 6, 2020
  4. Junio C HamanoJul 8, 2020
  5. Johannes SchindelinJul 9, 2020

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.