Subject: 24.0.50; vc-git-stash-show not escaping name

From: [email-masked] (João Távora)
Date: Tue, 18 Oct 2011 15:48:21 +0100

1. Start emacs -Q
2. Find a file in a git repository with a stash named stash@{0}
3. Try to show a stash
4. Be presented with an error message like

    fatal: ambiguous argument 'stash@0': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions

The problem seems to happen because the curly braces in the stash name
aren't shell-quoted. Using `shell-quote-argument' in `vc-git-command'
helps...

(defun vc-git-command (buffer okstatus file-or-list &rest flags)
  "A wrapper around `vc-do-command' for use in vc-git.el.
The difference to vc-do-command is that this function always invokes
`vc-git-program'."
  (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program
         file-or-list (mapcar #'shell-quote-argument flags)))

Thanks!
João Távora

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-04-02 on YAMALOK
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --cflags  -m32 -O2 -g0 -march=prescott -mtune=prescott -pipe -IC:/gnuwin32/emacs/include -IC:/gnuwin32/emacs/lib -IC:/gnuwin32/src --ldflags  -s '

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  delete-selection-mode: t
  yas/global-mode: t
  yas/minor-mode: t
  display-time-mode: t
  autopair-mode: t
  autopair-global-mode: t
  global-hl-line-mode: t
  recentf-mode: t
  show-paren-mode: t
  ido-everywhere: t
  global-hs-mode: t
  eldoc-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  hs-minor-mode: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-p <help-echo> <down-mouse-1> 
<mouse-2> <help-echo> C-p C-p C-p C-n C-n C-n RET C-x 
b RET C-x C-b C-x b h e RET RET C-n C-n C-n C-n C-n 
C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-n C-n C-n C-e M-b M-b M-b 
M-b M-b M-b M-b M-b M-b M-b M-b M-b M-b M-b C-s C-w 
C-w C-w C-p C-n C-x i RET C-p C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-n C-e C-x o C-x b C-s C-s 
C-s RET M-x v c SPC g i t SPC s t a <tab> SPC s h o 
<tab> RET <tab> <tab> <M-backspace> s t a s h @ { 0 
C-e RET C-x b C-s RET C-n C-n C-e M-b C-h f s h e l 
l SPC e s <tab> <tab> <tab> <backspace> <backspace> 
<tab> <tab> q u o <tab> a r <tab> RET C-x C-o C-p C-n 
( s h e l l - q u o t e - a r g u m e n t SPC C-d C-e 
) C-c C-c C-p C-n C-M-x C-p C-n M-x M-p RET M-p M-p 
RET C-x b C-s C-s C-s RET M-x M-p RET M-p RET C-x 1 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> C-x b C-s RET C-p C-n C-p C-n C-n C-n C-n 
C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-n 
C-p C-p C-p C-p C-a C-SPC C-n C-n C-n C-n C-n C-n C-n 
C-n C-e <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> M-x r e p o r t SPC e m a 
<tab> <return>

Recent messages:
Quit [3 times]
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Mark saved where search started
Making completion list...
Type C-x 4 C-o RET to restore the other window.
eval'ed contents of vc-git.el
vc-git-stash-show
Auto-saving...
Mark set

Load-path shadows:
z:/siscog/sc-slime/slime/hyperspec hides z:/siscog/sc-slime/cl-hyperspec/hyperspec
z:/siscog/sc-slime/cl-shell/completion hides z:/Vendor/ntemacs24/lisp/completion
z:/holy/share/emacs/common/site-lisp/package hides z:/Vendor/ntemacs24/lisp/emacs-lisp/package
z:/Vendor/ntemacs24/lisp/nxml/xmltok hides z:/holy/share/emacs/common/site-lisp/10hacks/xmltok
z:/Vendor/ntemacs24/lisp/progmodes/flymake hides z:/holy/share/emacs/common/site-lisp/10hacks/flymake
z:/Vendor/ntemacs24/lisp/linum hides z:/holy/share/emacs/common/site-lisp/20misc/linum
z:/holy/share/emacs/common/site-lisp/20misc/markdown-mode hides z:/holy/share/emacs/common/site-lisp/50ruby/markdown-mode

Features:
(shadow sort mail-extr gnus-msg emacsbug vc-annotate vc-bzr sha1
hex-util vc-sccs vc-cvs vc-rcs vc-dir ewoc bookmark apropos mule-diag
whitespace skeleton sh-script diff-mode ibuf-ext delsel cua-rect rect
dired-aux color crm sendmail url-util url-parse url-vars zenburn
color-theme vc-svn find-func animate bridge cltl2 ps-print ps-def lpr
fi-manual allegro-manual-data slime-indentation slime-banner slime-fancy
slime-fontifying-fu slime-package-fu slime-references slime-scratch
slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-parse slime-repl slime
hyperspec browse-url face-remap org-wl org-w3m org-vm org-rmail org-mhe
org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-agenda org-info org-gnus org-docview org-bibtex
org-bbdb org warnings ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys ob ob-eval org-complete pcomplete
org-list org-faces org-compat org-entities org-macs cal-menu calendar
cal-loaddefs cl-specs edebug multi-isearch cus-edit log-edit pcvs-util
add-log newcomment cus-start cus-load hippie-exp fill-column-indicator
debug executable vc-git tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile tramp-loaddefs pp cygwin-mount ange-ftp ack grep
cedet yasnippet dropdown-list help-mode yaml-mode woman man assoc
highlight-regexp ruby-mode flymake perl-find-library cperl-mode
sgml-mode rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap nxml-util nxml-glyph nxml-enc xmltok time markdown-mode
noutline outline imenu cua-base autopair hl-line windmove uniquify
recentf tree-widget paren ido hideshowvis hideshow vc vc-dispatcher
sass-mode haml-mode derived gnus-cite gnus-art mm-uu mml2015 epg-config
mm-view mml-smime smime password-cache dig mailcap nnir gnus-sum
macroexp nnoo gnus-group gnus-undo nnmail mail-source gnus-start
gnus-spec gnus-int message format-spec rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win gnus-range gnus gnus-ems
nnheader gnus-util time-date mail-utils mm-util mail-prsvr wid-edit
etags em-cmpl em-term term ehelp electric em-prompt esh-var esh-io
esh-cmd esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module
esh-mode esh-util server vc-ediff ediff-merg ediff-diff ediff-wind
ediff-help ediff-util ediff-mult ediff-init ediff dired-details+ advice
help-fns advice-preload dired-details dired-x dired view thingatpt
compile comint ring rcompile cc-mode cc-fonts easymenu cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt edmacro kmacro
ibuffer package reporter heretic-project easy-mmode holy cl tooltip
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp
w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer button
faces cus-face files text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process multi-tty emacs)