threads / discuss / 18828

git-stash fails on OSX 10.5

Subject: git-stash fails on OSX 10.5

## tl;dr

5 messages between Apr 10, 2009 and Apr 13, 2009.

replies: 4people: 3as markdown or json

Jacob Kaplan-Moss· Apr 10, 2009, 16:44 UTC · lore
Hi folks --

I'm stumped; git-stash simply won't work on my machine. On any repository I've tried, with various permutations, I keep getting::

    $ git stash
    cp: `.../.git/index': No such file or directory
    Cannot save the current worktree state

I spent about an hour in #git this morning trying to track it down (log: http://colabti.org/irclogger/irclogger_log/git?date=2009-04-10#l1946). I've tried stashing with and without content added to the index; I've also tried entirely removing .git/index and then recreating it via git reset. No dice.

I'm entirely willing to entertain the possibility that this is my fault, but I am fairly familiar with git (been using it for about a year) and so if it is fault it's gotta be something pretty subtle.

I'm concerned by the fact that it doesn't work on *any* repository on my machine, though. I think that points to a systematic problem.

I'm on OS X 10.5.6; Git is 1.6.2.2, built and installed from source, though the same problem happened with the old 1.6.0 I had yesterday, and also the 1.6.2.1 I installed via the OSX package.

Thanks!
Jacob
Junio C Hamano· Apr 10, 2009, 17:26 UTC · re: Jacob Kaplan-Moss · lore

Re: git-stash fails on OSX 10.5

Jacob Kaplan-Moss <jacob@jacobian.org> writes:
Show 8 quoted lines
> Hi folks --
>
> I'm stumped; git-stash simply won't work on my machine. On any
> repository I've tried, with various permutations, I keep getting::
>
>     $ git stash
>     cp: `.../.git/index': No such file or directory
>     Cannot save the current worktree state
Are you exporting 
	GIT_INDEX_FILE=.../.git/index
into the environment, and that path perhaps does not exist?

Otherwise the above error message wouldn't have said ".../.git/index"; it is coming from the only invocation of "cp" command in git-stash.sh

Jacob Kaplan-Moss· Apr 10, 2009, 18:14 UTC · re: Junio C Hamano · lore

Re: git-stash fails on OSX 10.5

On Fri, Apr 10, 2009 at 12:26 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Otherwise the above error message wouldn't have said ".../.git/index"; it
> is coming from the only invocation of "cp" command in git-stash.sh

Sorry; I trimmed the error message to omit the details of where the repository is since this happens regardless of the repo. The error gives the full path to the file, i.e. "cp: `/Users/jacob/Projects/uri/.git/index': No such file or directory".

Jacob
Jay Soffian· Apr 13, 2009, 17:57 UTC · re: Jacob Kaplan-Moss · lore

Re: git-stash fails on OSX 10.5

On Fri, Apr 10, 2009 at 2:14 PM, Jacob Kaplan-Moss <jacob@jacobian.org> wrote:
> Sorry; I trimmed the error message to omit the details of where the
> repository is since this happens regardless of the repo. The error
> gives the full path to the file, i.e. "cp:
> `/Users/jacob/Projects/uri/.git/index': No such file or directory".
1) Does "ls -l /Users/jacob/Projects/uri/.git/index" work?
2) Does "cp -v /Users/jacob/Projects/uri/.git/index /tmp/" work?
3) Anything unusual for OS X? e.g., Are you using FileVault? Are you
using a filesystem other than case-insensitive HFS+? Is your cp
command something other than /bin/cp?
j.
Jacob Kaplan-Moss· Apr 13, 2009, 18:13 UTC · re: Jay Soffian · lore

Re: git-stash fails on OSX 10.5

Hey Jay --
Thanks for the questions; they helped me figure out a bit more:
On Mon, Apr 13, 2009 at 12:57 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
> 3) Anything unusual for OS X? e.g., Are you using FileVault? Are you
> using a filesystem other than case-insensitive HFS+? Is your cp
> command something other than /bin/cp?
The filesystem is case-*sensitive* HFS+:
$ diskutil info disk0s2
...
   File System:              Case-sensitive Journaled HFS+
... and cp is GNU cp, not Apple's:

$ which cp /usr/local/bin/cp

Looks like if I use Apple's cp then stash works again:

$ mv /usr/local/bin/cp /usr/local/bin/cp~ $ which cp /bin/cp $ git stash Saved working directory and index state "WIP on master: 504b9bd Updated README."HEAD is now at 504b9bd Updated README. (To restore them type "git stash apply")

So clearly there's some interaction between git-stash, case-sensitivity, and GNU cp. Given that GNU cp works correctly when I do it by hand (i.e. "cp -v /Users/jacob/Projects/uri/.git/index /tmp/" works), I suspect that git-stash is getting the case wrong somewhere and Apple's cp is automatically correcting for that error.

That's my theory, anyway; my bash-fu isn't that good, so I've not been able to figure out a way to patch git-stash to work around the problem. I've got a strange setup, I guess, so I understand if this is a "just don't do that" kind of situation.

Thanks!
Jacob

← back to recent threads