* bug: git-stash save and symbolic links
@ 2008-10-20 8:34 Simon Strandgaard
2008-10-20 15:17 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Simon Strandgaard @ 2008-10-20 8:34 UTC (permalink / raw)
To: git
git-stash cannot find the repository when the path is a symbolic link.
solution for me was to cd to the absolute path and then do git-stash.
FAILURE: git-stash with symbolic link.
prompt> pwd
/Users/neoneye/st
prompt> ls -la ~/st
lrwxr-xr-x 1 neoneye neoneye 38 10 Okt 07:40 /Users/neoneye/st ->
/Users/neoneye/git/code/source_toolbox
prompt> git-stash
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
You do not have the initial commit yet
prompt>
SUCCESS: git-stash without symbolic link.
prompt> pwd
/Users/neoneye/git/code
prompt> ls -la
drwxr-xr-x 16 neoneye neoneye 544 20 Okt 10:18 .git
drwxr-xr-x 29 neoneye neoneye 986 16 Okt 13:04 source_toolbox
prompt> git stash save "did I mess up"
Saved working directory and index state "On master: did I mess up"
HEAD is now at 90ac45d we can now seek through a WAV file.. finally.
prompt>
I think the problem is located in the save_stash() function, but
im not good at sh scripting to make a patch.
Thank you very much for git!
--
Simon Strandgaard
http://toolboxapp.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: bug: git-stash save and symbolic links
2008-10-20 8:34 bug: git-stash save and symbolic links Simon Strandgaard
@ 2008-10-20 15:17 ` Jeff King
2008-10-20 15:32 ` Simon Strandgaard
0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2008-10-20 15:17 UTC (permalink / raw)
To: Simon Strandgaard; +Cc: git
On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:
> git-stash cannot find the repository when the path is a symbolic link.
> solution for me was to cd to the absolute path and then do git-stash.
Sorry, I can't reproduce here, using this test:
mkdir repo &&
cd repo &&
git init &&
echo content >file &&
git add file &&
git commit -m one &&
cd .. &&
ln -s repo linked &&
cd repo &&
echo cruft >>file &&
git stash &&
echo non-linked directory stashed ok &&
cd ../linked &&
echo cruft >>file &&
git stash &&
echo linked directory stashed ok
What version of git are you running (though I tried a few different
ones, and all passed my test)?
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: bug: git-stash save and symbolic links
2008-10-20 15:17 ` Jeff King
@ 2008-10-20 15:32 ` Simon Strandgaard
2008-10-20 15:39 ` Simon Strandgaard
0 siblings, 1 reply; 5+ messages in thread
From: Simon Strandgaard @ 2008-10-20 15:32 UTC (permalink / raw)
To: Jeff King; +Cc: git
On Mon, Oct 20, 2008 at 5:17 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:
[snip]
> What version of git are you running (though I tried a few different
> ones, and all passed my test)?
I have made some changes, so it can be reproduced
prompt> sh run.sh
Initialized empty Git repository in /Users/neoneye/Desktop/test/repo/.git/
Created initial commit a2a7d6f: one
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file
before stash
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
You do not have the initial commit yet
prompt> cat run.sh
rm -rf repo &&
rm -f linked &&
mkdir repo &&
cd repo &&
git init &&
echo content >file &&
git add file &&
git commit -m one &&
mkdir test &&
cd .. &&
ln -s repo/test linked &&
cd linked &&
echo cruft >>file &&
echo before stash &&
git stash &&
echo after stash
prompt> pwd
/Users/neoneye/Desktop/test
prompt>
This is my computer
prompt> git --version
git version 1.5.6.2
prompt> uname -a
Darwin Macintosh.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3
11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386
prompt>
--
Simon Strandgaard
http://toolboxapp.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: bug: git-stash save and symbolic links
2008-10-20 15:32 ` Simon Strandgaard
@ 2008-10-20 15:39 ` Simon Strandgaard
2008-10-20 17:55 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Simon Strandgaard @ 2008-10-20 15:39 UTC (permalink / raw)
To: Jeff King; +Cc: git
On Mon, Oct 20, 2008 at 5:32 PM, Simon Strandgaard <neoneye@gmail.com> wrote:
> On Mon, Oct 20, 2008 at 5:17 PM, Jeff King <peff@peff.net> wrote:
>> On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:
> [snip]
>> What version of git are you running (though I tried a few different
>> ones, and all passed my test)?
>
>
> I have made some changes, so it can be reproduced
[snip]
Sorry, forget the other run.sh I forgot to add the dir to the repository.
Here the linked dir is included in the repository.
prompt> sh run.sh
Initialized empty Git repository in /Users/neoneye/Desktop/test/repo/.git/
Created initial commit b904776: one
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file
Created commit 19746b5: two
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 test/file2
before stash
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
You do not have the initial commit yet
prompt> cat run.sh
rm -rf repo &&
rm -f linked &&
mkdir repo &&
cd repo &&
git init &&
echo content >file &&
git add file &&
git commit -m one &&
mkdir test &&
echo content >test/file2 &&
git add test/file2 &&
git commit -m two &&
cd .. &&
ln -s repo/test linked &&
cd linked &&
echo cruft >>file &&
echo before stash &&
git stash &&
echo after stash
prompt> pwd
/Users/neoneye/Desktop/test
prompt>
[snip]
> This is my computer
>
> prompt> git --version
> git version 1.5.6.2
> prompt> uname -a
> Darwin Macintosh.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3
> 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386
> prompt>
>
>
> --
> Simon Strandgaard
> http://toolboxapp.com/
>
--
Simon Strandgaard
http://toolboxapp.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: bug: git-stash save and symbolic links
2008-10-20 15:39 ` Simon Strandgaard
@ 2008-10-20 17:55 ` Jeff King
0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2008-10-20 17:55 UTC (permalink / raw)
To: Simon Strandgaard; +Cc: git
On Mon, Oct 20, 2008 at 05:39:31PM +0200, Simon Strandgaard wrote:
> mkdir test &&
> echo content >test/file2 &&
> git add test/file2 &&
> git commit -m two &&
> cd .. &&
> ln -s repo/test linked &&
Ah, OK. You have a symlink into a subdirectory of the repository. Git
correctly finds the repository's .git directory, but then when we
attempt to 'cd' to the top-level of the working tree, we end up outside
of the repository. The culprit is actually "git rev-parse --show-cdup".
This demonstrates it more simply:
mkdir repo &&
(cd repo && git init) &&
mkdir repo/dir &&
ln -s repo/dir linked &&
cd linked && git rev-parse --show-cdup
which prints "../". But that's not right; we actually need to go to
"../repo".
I think the right solution in this situation is that we should _not_ be
setting is_inside_work_tree in setup_git_directory_gently, so that we
chdir to its absolute path. But I don't think we ever actually detect
the symlink during this setup, so I'm not sure how best to realize we
are _in_ this situation.
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-20 17:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20 8:34 bug: git-stash save and symbolic links Simon Strandgaard
2008-10-20 15:17 ` Jeff King
2008-10-20 15:32 ` Simon Strandgaard
2008-10-20 15:39 ` Simon Strandgaard
2008-10-20 17:55 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).