git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Simon Strandgaard <neoneye@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: bug: git-stash save and symbolic links
Date: Mon, 20 Oct 2008 13:55:17 -0400	[thread overview]
Message-ID: <20081020175517.GA18539@coredump.intra.peff.net> (raw)
In-Reply-To: <df1390cc0810200839q5eddad1cp4bc14762724d8848@mail.gmail.com>

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

      reply	other threads:[~2008-10-20 17:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081020175517.GA18539@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=neoneye@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).