git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Jack O'Connor" <oconnor663@gmail.com>
To: git <git@vger.kernel.org>
Subject: GIT_INDEX_FILE relative paths are relative to the work tree
Date: Fri, 27 Nov 2015 10:17:42 -0500	[thread overview]
Message-ID: <CA+6di1=4GwDg1kksJiKrVtDYSy=Sk=opWcg0=Ekwf0-OoQ2X9g@mail.gmail.com> (raw)

When I use a relative path in the GIT_INDEX_FILE environment variable,
git interprets that path relative to the the work tree. This can be
confusing if my cwd is some subdirectory of my project; in that case
an index file is created in the project root rather than in my cwd. It
can also be confusing if I'm using --git-dir and --work-tree, in which
case the path is interpreted relative to the latter.

Is this behavior intentional? If so, I think it would be worth
mentioning in the documentation for GIT_INDEX_FILE. But I can't think
of a case where I would ever want an index file to end up inside my
work tree.

This also comes up in http://stackoverflow.com/a/7645492/823869. Using
absolute paths is a workaround.

             reply	other threads:[~2015-11-27 15:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 15:17 Jack O'Connor [this message]
2015-11-27 15:35 ` GIT_INDEX_FILE relative paths are relative to the work tree Duy Nguyen

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CA+6di1=4GwDg1kksJiKrVtDYSy=Sk=opWcg0=Ekwf0-OoQ2X9g@mail.gmail.com' \
    --to=oconnor663@gmail.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).