# BUG: "git stash apply <arg>" broken, "git-stash apply <arg>" works

3 messages from 2008-06-04 to 2008-06-05. Participants: Eric Raible, Johannes Schindelin.
Thread: https://gitlist.dev/t/13805

## Eric Raible, 2008-06-04 23:46

Subject: BUG: "git stash apply <arg>" broken, "git-stash apply <arg>" works
Message-ID: <279b37b20806041646jc29a695w685c3e01efc0dd0b@mail.gmail.com>
URL: https://gitlist.dev/e/279b37b20806041646jc29a695w685c3e01efc0dd0b%40mail.gmail.com

```
Synopsis:
"git stash apply stash@{1}" doesn't work, but
"git-stash apply stash@{1}" does.

Platform:
win xp (yeah, I know, I know)
msys (Git-1.5.5-preview20080413.exe)
git version 1.5.5.1015.g9d258

To reproduce:
	# Create a minimal repo
	mkdir stash-bug
	cd stash-bug
	git init
	echo line1 > file
	git add file
	git commit -m initial

	# Create the stash that we'll use
	echo "This is correct" > file
	git stash save "Save off correct line in what will be stash@{1}"

	# Create another stash (the default one) which we won't use
	echo "This should not be shown" > file
	git stash save "Save off incorrect line in what will be stash@{0}"

	# They are correctly created
	git stash list

	# "git-stash apply arg" works
	git reset --hard
	git-stash apply stash@{1}
	echo "git-stash apply respects its argument"
	cat file

	# But "git stash apply arg" doesn't
	git reset --hard
	git stash apply stash@{1}
	echo "git stash apply (no dash) doesn't respect its argument"
	cat file

- Eric

```

## Johannes Schindelin, 2008-06-05 00:13

Subject: Re: BUG: "git stash apply <arg>" broken, "git-stash apply <arg>" works
Message-ID: <alpine.DEB.1.00.0806050112550.21190@racer>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0806050112550.21190%40racer
In-Reply-To: <279b37b20806041646jc29a695w685c3e01efc0dd0b@mail.gmail.com>

```
Hi,

On Wed, 4 Jun 2008, Eric Raible wrote:

> Synopsis:
> "git stash apply stash@{1}" doesn't work, but
> "git-stash apply stash@{1}" does.
> 
> Platform:
> win xp (yeah, I know, I know)
> msys (Git-1.5.5-preview20080413.exe)

This is most likely an issue with MSys, not Git.  As far as I know, 
Steffen started to have a look at it, but I do not really know: I took my 
retreat from msysGit.

Ciao,
Dscho

```

## Eric Raible, 2008-06-05 11:17

Subject: Re: BUG: "git stash apply <arg>" broken, "git-stash apply <arg>" works
Message-ID: <loom.20080605T110928-264@post.gmane.org>
URL: https://gitlist.dev/e/loom.20080605T110928-264%40post.gmane.org
In-Reply-To: <alpine.DEB.1.00.0806050112550.21190@racer>

```
Johannes Schindelin <Johannes.Schindelin <at> gmx.de> writes:

> 
> This is most likely an issue with MSys, not Git.  As far as I know, 
> Steffen started to have a look at it, but I do not really know: I took my 
> retreat from msysGit.
> 
> Ciao,
> Dscho
> 

Not surprisingly this was exactly right, and I just posted a patch on
http://code.google.com/p/msysgit/ which fixes it.  It turns out that
command lines passed to CreateProcess() which contain '{' need to be
quoted (specifically quote_arg() needs to set 'force_quotes' to 1).

Thanks for the pointer.

- Eric

```
