# git-stash fails on OSX 10.5

5 messages from 2009-04-10 to 2009-04-13. Participants: Jacob Kaplan-Moss, Junio C Hamano, Jay Soffian.
Thread: https://gitlist.dev/t/18828

## Jacob Kaplan-Moss, 2009-04-10 16:44

Subject: git-stash fails on OSX 10.5
Message-ID: <be4ebbe10904100944p6ec2c0dao8607fcff75d2754e@mail.gmail.com>
URL: https://gitlist.dev/e/be4ebbe10904100944p6ec2c0dao8607fcff75d2754e%40mail.gmail.com

```
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, 2009-04-10 17:26

Subject: Re: git-stash fails on OSX 10.5
Message-ID: <7vy6u8whbp.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vy6u8whbp.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <be4ebbe10904100944p6ec2c0dao8607fcff75d2754e@mail.gmail.com>

```
Jacob Kaplan-Moss <jacob@jacobian.org> writes:

> 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, 2009-04-10 18:14

Subject: Re: git-stash fails on OSX 10.5
Message-ID: <be4ebbe10904101114w33c807d1je19b0c949e9a2009@mail.gmail.com>
URL: https://gitlist.dev/e/be4ebbe10904101114w33c807d1je19b0c949e9a2009%40mail.gmail.com
In-Reply-To: <7vy6u8whbp.fsf@gitster.siamese.dyndns.org>

```
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, 2009-04-13 17:57

Subject: Re: git-stash fails on OSX 10.5
Message-ID: <76718490904131057k2801a62bn14825b055b345dfe@mail.gmail.com>
URL: https://gitlist.dev/e/76718490904131057k2801a62bn14825b055b345dfe%40mail.gmail.com
In-Reply-To: <be4ebbe10904101114w33c807d1je19b0c949e9a2009@mail.gmail.com>

```
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, 2009-04-13 18:13

Subject: Re: git-stash fails on OSX 10.5
Message-ID: <be4ebbe10904131113q5b221fe9kf7e0a0fe3bb7fdc6@mail.gmail.com>
URL: https://gitlist.dev/e/be4ebbe10904131113q5b221fe9kf7e0a0fe3bb7fdc6%40mail.gmail.com
In-Reply-To: <76718490904131057k2801a62bn14825b055b345dfe@mail.gmail.com>

```
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

```
