git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Anthony Sottile <asottile@umich.edu>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git rev-parse --show-toplevel inside `.git` returns 0 and prints nothing
Date: Tue, 19 Nov 2019 02:37:54 -0500	[thread overview]
Message-ID: <20191119073754.GA30634@sigill.intra.peff.net> (raw)
In-Reply-To: <CA+dzEBmekzDVdqy=4GDF+Wm8e-YTPEdbh0oVowZNQYO67vEhEg@mail.gmail.com>

On Mon, Nov 18, 2019 at 08:13:02PM -0800, Anthony Sottile wrote:

> > I think the reason this hasn't come up until now is callers are expected
> > to use require_work_tree() or "rev-parse --is-inside-work-tree" first.
> >
> > It would probably make sense for the rev-parse documentation to also
> > clarify what "the top-level directory" is.
> >
> > -Peff
> 
> I realize I forgot to include the X to my Y :) -- this was a totally
> silly case that I got as a bug report:
> https://github.com/pre-commit/pre-commit/issues/1219
> 
> I *expected* an error case but didn't get one

Yes, and I do agree that an error is the right thing.

Would that have helped your pre-commit script? I guess it would have
barfed at that point. :) It sounds like it should be checking first that
it has a working tree.

-Peff

  reply	other threads:[~2019-11-19  7:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 22:26 git rev-parse --show-toplevel inside `.git` returns 0 and prints nothing Anthony Sottile
2019-11-19  2:52 ` Junio C Hamano
2019-11-19  3:33   ` Jeff King
2019-11-19  4:13     ` Anthony Sottile
2019-11-19  7:37       ` Jeff King [this message]
2019-11-19  8:05     ` Jeff King

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=20191119073754.GA30634@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=asottile@umich.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).