{"thread":{"id":"15976","subject":"bug: git-stash save and symbolic links","startedAt":"2008-10-20T08:34:53Z","lastAt":"2008-10-20T17:55:17Z","messageCount":5,"participants":["Simon Strandgaard","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"93499","messageId":"df1390cc0810200134x68a8eb1fyc7f24650c8c9c5d3@mail.gmail.com","threadId":"15976","inReplyTo":null,"subject":"bug: git-stash save and symbolic links","fromName":"Simon Strandgaard","fromEmail":"neoneye@gmail.com","sentAt":"2008-10-20T08:34:53Z","receivedAt":"2008-10-20T08:34:53Z","isPatch":false,"sender":{"key":"neoneye@gmail.com","avatar":"https://gravatar.com/avatar/27e9d5599fd07b2705ef9c5fc11968319dbe137d1574764fc1ab77bdeda36870?d=mp&s=160"},"body":"git-stash cannot find the repository when the path is a symbolic link.\nsolution for me was to cd to the absolute path and then do git-stash.\n\nFAILURE: git-stash with symbolic link.\n\nprompt> pwd\n/Users/neoneye/st\nprompt> ls -la ~/st\nlrwxr-xr-x  1 neoneye  neoneye  38 10 Okt 07:40 /Users/neoneye/st ->\n/Users/neoneye/git/code/source_toolbox\nprompt> git-stash\nfatal: Not a git repository\nfatal: Not a git repository\nfatal: Not a git repository\nYou do not have the initial commit yet\nprompt>\n\n\nSUCCESS: git-stash without symbolic link.\n\nprompt> pwd\n/Users/neoneye/git/code\nprompt> ls -la\ndrwxr-xr-x  16 neoneye  neoneye   544 20 Okt 10:18 .git\ndrwxr-xr-x  29 neoneye  neoneye   986 16 Okt 13:04 source_toolbox\nprompt> git stash save \"did I mess up\"\nSaved working directory and index state \"On master: did I mess up\"\nHEAD is now at 90ac45d we can now seek through a WAV file.. finally.\nprompt>\n\n\nI think the problem is located in the save_stash() function, but\nim not good at sh scripting to make a patch.\n\n\n\nThank you very much for git!\n\n\n-- \nSimon Strandgaard\nhttp://toolboxapp.com/\n"},{"id":"93524","messageId":"20081020151715.GA13553@coredump.intra.peff.net","threadId":"15976","inReplyTo":"df1390cc0810200134x68a8eb1fyc7f24650c8c9c5d3@mail.gmail.com","subject":"Re: bug: git-stash save and symbolic links","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-10-20T15:17:16Z","receivedAt":"2008-10-20T15:17:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:\n\n> git-stash cannot find the repository when the path is a symbolic link.\n> solution for me was to cd to the absolute path and then do git-stash.\n\nSorry, I can't reproduce here, using this test:\n\n    mkdir repo &&\n    cd repo &&\n      git init &&\n      echo content >file &&\n      git add file &&\n      git commit -m one &&\n    cd .. &&\n      ln -s repo linked &&\n    cd repo &&\n      echo cruft >>file &&\n      git stash &&\n      echo non-linked directory stashed ok &&\n    cd ../linked &&\n      echo cruft >>file &&\n      git stash &&\n      echo linked directory stashed ok\n\nWhat version of git are you running (though I tried a few different\nones, and all passed my test)?\n\n-Peff\n"},{"id":"93538","messageId":"df1390cc0810200832i4fa974fx1d70ed489aa1be02@mail.gmail.com","threadId":"15976","inReplyTo":"20081020151715.GA13553@coredump.intra.peff.net","subject":"Re: bug: git-stash save and symbolic links","fromName":"Simon Strandgaard","fromEmail":"neoneye@gmail.com","sentAt":"2008-10-20T15:32:32Z","receivedAt":"2008-10-20T15:32:32Z","isPatch":false,"sender":{"key":"neoneye@gmail.com","avatar":"https://gravatar.com/avatar/27e9d5599fd07b2705ef9c5fc11968319dbe137d1574764fc1ab77bdeda36870?d=mp&s=160"},"body":"On Mon, Oct 20, 2008 at 5:17 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:\n[snip]\n> What version of git are you running (though I tried a few different\n> ones, and all passed my test)?\n\n\nI have made some changes, so it can be reproduced\n\nprompt> sh run.sh\nInitialized empty Git repository in /Users/neoneye/Desktop/test/repo/.git/\nCreated initial commit a2a7d6f: one\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file\nbefore stash\nfatal: Not a git repository\nfatal: Not a git repository\nfatal: Not a git repository\nYou do not have the initial commit yet\n\nprompt> cat run.sh\nrm -rf repo &&\nrm -f linked &&\nmkdir repo &&\n   cd repo &&\n     git init &&\n     echo content >file &&\n     git add file &&\n     git commit -m one &&\n     mkdir test &&\n   cd .. &&\n     ln -s repo/test linked &&\n   cd linked &&\n     echo cruft >>file &&\n     echo before stash &&\n     git stash &&\n     echo after stash\n\nprompt> pwd\n/Users/neoneye/Desktop/test\nprompt>\n\n\nThis is my computer\n\nprompt> git --version\ngit version 1.5.6.2\nprompt> uname -a\nDarwin Macintosh.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep  3\n11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386\nprompt>\n\n\n-- \nSimon Strandgaard\nhttp://toolboxapp.com/\n"},{"id":"93521","messageId":"df1390cc0810200839q5eddad1cp4bc14762724d8848@mail.gmail.com","threadId":"15976","inReplyTo":"df1390cc0810200832i4fa974fx1d70ed489aa1be02@mail.gmail.com","subject":"Re: bug: git-stash save and symbolic links","fromName":"Simon Strandgaard","fromEmail":"neoneye@gmail.com","sentAt":"2008-10-20T15:39:31Z","receivedAt":"2008-10-20T15:39:31Z","isPatch":false,"sender":{"key":"neoneye@gmail.com","avatar":"https://gravatar.com/avatar/27e9d5599fd07b2705ef9c5fc11968319dbe137d1574764fc1ab77bdeda36870?d=mp&s=160"},"body":"On Mon, Oct 20, 2008 at 5:32 PM, Simon Strandgaard <neoneye@gmail.com> wrote:\n> On Mon, Oct 20, 2008 at 5:17 PM, Jeff King <peff@peff.net> wrote:\n>> On Mon, Oct 20, 2008 at 10:34:53AM +0200, Simon Strandgaard wrote:\n> [snip]\n>> What version of git are you running (though I tried a few different\n>> ones, and all passed my test)?\n>\n>\n> I have made some changes, so it can be reproduced\n[snip]\n\nSorry, forget the other run.sh I forgot to add the dir to the repository.\nHere the linked dir is included in the repository.\n\nprompt> sh run.sh\nInitialized empty Git repository in /Users/neoneye/Desktop/test/repo/.git/\nCreated initial commit b904776: one\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file\nCreated commit 19746b5: two\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 test/file2\nbefore stash\nfatal: Not a git repository\nfatal: Not a git repository\nfatal: Not a git repository\nYou do not have the initial commit yet\n\nprompt> cat run.sh\nrm -rf repo &&\nrm -f linked &&\nmkdir repo &&\n   cd repo &&\n     git init &&\n     echo content >file &&\n     git add file &&\n     git commit -m one &&\n     mkdir test &&\n     echo content >test/file2 &&\n     git add test/file2 &&\n     git commit -m two &&\n   cd .. &&\n     ln -s repo/test linked &&\n   cd linked &&\n     echo cruft >>file &&\n     echo before stash &&\n     git stash &&\n     echo after stash\n\nprompt> pwd\n/Users/neoneye/Desktop/test\nprompt>\n\n\n[snip]\n> This is my computer\n>\n> prompt> git --version\n> git version 1.5.6.2\n> prompt> uname -a\n> Darwin Macintosh.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep  3\n> 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386\n> prompt>\n>\n>\n> --\n> Simon Strandgaard\n> http://toolboxapp.com/\n>\n\n\n\n-- \nSimon Strandgaard\nhttp://toolboxapp.com/\n"},{"id":"93537","messageId":"20081020175517.GA18539@coredump.intra.peff.net","threadId":"15976","inReplyTo":"df1390cc0810200839q5eddad1cp4bc14762724d8848@mail.gmail.com","subject":"Re: bug: git-stash save and symbolic links","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-10-20T17:55:17Z","receivedAt":"2008-10-20T17:55:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Oct 20, 2008 at 05:39:31PM +0200, Simon Strandgaard wrote:\n\n>      mkdir test &&\n>      echo content >test/file2 &&\n>      git add test/file2 &&\n>      git commit -m two &&\n>    cd .. &&\n>      ln -s repo/test linked &&\n\nAh, OK. You have a symlink into a subdirectory of the repository. Git\ncorrectly finds the repository's .git directory, but then when we\nattempt to 'cd' to the top-level of the working tree, we end up outside\nof the repository. The culprit is actually \"git rev-parse --show-cdup\".\nThis demonstrates it more simply:\n\n  mkdir repo &&\n  (cd repo && git init) &&\n  mkdir repo/dir &&\n  ln -s repo/dir linked &&\n  cd linked && git rev-parse --show-cdup\n\nwhich prints \"../\". But that's not right; we actually need to go to\n\"../repo\".\n\nI think the right solution in this situation is that we should _not_ be\nsetting is_inside_work_tree in setup_git_directory_gently, so that we\nchdir to its absolute path. But I don't think we ever actually detect\nthe symlink during this setup, so I'm not sure how best to realize we\nare _in_ this situation.\n\n-Peff\n"}]}