From: Elliott Cable <me@ell.io>
To: git@vger.kernel.org
Subject: `git rev-parse --git-dir` relative to current working directory?
Date: Tue, 29 Mar 2016 05:32:31 -0500 [thread overview]
Message-ID: <CAPZ477NfQ7pCiHQ3V42kZ1Cic5UPP03TCFPvABR_ugSZYEn4xg@mail.gmail.com> (raw)
So, `git help rev-parse` [mentions the following][rev-parse], as of
2.8.0:
--git-dir
Show $GIT_DIR if defined. Otherwise show the path to the .git
directory. The path shown, when relative, is relative to the
current working directory.
However, when inside a symlinked repository, this doesn't function as
advertised:
$ ln -s a-symlink a-git-repo
$ cd a-symlink/.git/hooks
$ git rev-parse --git-dir
/Users/ec/Documents/a-git-repo/.git
From my reading of that snippet of documentation (“The path shown ... is
relative to the CWD”), I'd expect to receive `..`, not
`/absolute/path/to/a-git-repo/.git`.
Is the documentation incorrect, or is this a bug? (I'm hoping the
latter: I'm trying to write git-scripting that is sensitive to symlinks,
i.e. retains the user's CWD without unintentionally resolving symlinks
in their path during operation; and it'd be ideal if this were handled
as documented, saving me manual effort checking symlinks.)
⁓ ELLIOTTCABLE — fly safe.
http://ell.io/tt
[rev-parse]:
<https://git-scm.com/docs/git-rev-parse/2.8.0#_options_for_files>
"git rev-parse documentation @2.8.0"
next reply other threads:[~2016-03-29 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 10:32 Elliott Cable [this message]
2016-03-29 10:50 ` `git rev-parse --git-dir` relative to current working directory? John Keeping
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=CAPZ477NfQ7pCiHQ3V42kZ1Cic5UPP03TCFPvABR_ugSZYEn4xg@mail.gmail.com \
--to=me@ell.io \
--cc=git@vger.kernel.org \
/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).