git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: John Keeping <john@keeping.me.uk>
Cc: "Elliott Cable" <me@ell.io>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	git@vger.kernel.org
Subject: Re: `git rev-parse --is-inside-work-tree` and $GIT_WORK_TREE
Date: Tue, 29 Mar 2016 18:16:57 -0400	[thread overview]
Message-ID: <20160329221657.GA31811@sigill.intra.peff.net> (raw)
In-Reply-To: <20160329220003.GG1578@serenity.lan>

On Tue, Mar 29, 2016 at 11:00:03PM +0100, John Keeping wrote:

> > We seem to get that wrong. I'm also not sure if it would make sense if
> > you explicitly set the two to be equal, like:
> > 
> >   # checking in your own refs?
> >   GIT_WORK_TREE=$(pwd) GIT_DIR=$(pwd) git add refs packed-refs
> > 
> > So the current behavior may just be weird-but-true.
> 
> This case definitely feels wrong:
> 
> 	$ GIT_WORK_TREE=$(cd ..; pwd) GIT_DIR=$(pwd) git rev-parse --is-inside-git-dir
> 	false

Yeah, and not just the is-inside-git-dir test:

  $ echo content >../file
  $ GIT_WORK_TREE=$(cd ..; pwd) GIT_DIR=$(pwd) git add file
  fatal: pathspec 'file' did not match any files

I'd expect that to work, and it doesn't, because we pass ".git/" as the
"prefix" to cmd_add(). Which I guess is true, but it feels kind of weird
(I think most people who set both variables like that would generally
point to some other directory entirely, and we would have a NULL
prefix).

The --is-inside-git-dir thing is related, but a different problem. I
just got your follow-up mentioning that it doesn't take the prefix into
account, which I agree it probably should.

-Peff

  parent reply	other threads:[~2016-03-29 22:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 11:42 `git rev-parse --is-inside-work-tree` and $GIT_WORK_TREE Elliott Cable
2016-03-29 11:53 ` Elliott Cable
2016-03-29 12:33   ` John Keeping
2016-03-29 15:08     ` Junio C Hamano
2016-03-29 19:41       ` Jeff King
2016-03-29 19:56         ` Junio C Hamano
2016-03-29 20:26           ` Jeff King
2016-03-29 20:34 ` Jeff King
2016-03-29 20:52   ` John Keeping
2016-03-29 21:21     ` Jeff King
2016-03-29 22:00       ` John Keeping
2016-03-29 22:14         ` John Keeping
2016-03-29 22:16         ` Jeff King [this message]
2016-03-29 22:35           ` Junio C Hamano
2016-03-30  0:53   ` Duy Nguyen
2016-04-01  0:49     ` Elliott Cable

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=20160329221657.GA31811@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=john@keeping.me.uk \
    --cc=me@ell.io \
    --cc=pclouds@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).