threads / bug / 13805

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

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

## tl;dr

3 messages between Jun 4, 2008 and Jun 5, 2008.

replies: 2people: 2as markdown or json

Eric Raible· Jun 4, 2008, 23:46 UTC · lore

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· Jun 5, 2008, 00:13 UTC · re: Eric Raible · lore

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

Hi,
On Wed, 4 Jun 2008, Eric Raible wrote:
Show 7 quoted lines
> 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· Jun 5, 2008, 11:17 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin <at> gmx.de> writes:
Show 8 quoted lines
> 
> 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

← back to recent threads