git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: What's cooking in git.git (Apr 2017, #01; Tue, 11)
Date: Tue, 11 Apr 2017 20:42:59 -0400	[thread overview]
Message-ID: <20170412004258.olfxsdbc3go25s7x@sigill.intra.peff.net> (raw)
In-Reply-To: <20170411224713.GS8741@aiede.mtv.corp.google.com>

On Tue, Apr 11, 2017 at 03:47:13PM -0700, Jonathan Nieder wrote:

> Junio C Hamano wrote:
> 
> > * jk/no-looking-at-dotgit-outside-repo-final (2016-10-26) 1 commit
> >   (merged to 'next' on 2017-02-27 at 7373a1b73d)
> >  + setup_git_env: avoid blind fall-back to ".git"
> >
> >  This is the endgame of the topic to avoid blindly falling back to
> >  ".git" when the setup sequence said we are _not_ in Git repository.
> >  A corner case that happens to work right now may be broken by a
> >  call to die("BUG").
> 
> There's one caller we missed, in "git apply" when you apply a binary
> patch outside any repository.

Good catch. This might also trigger with "apply --3way", but I didn't
check. Your patch would presumably fix that, too.

> diff --git a/sha1_file.c b/sha1_file.c
> index 71063890ff..bf1ff2ef77 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -3481,6 +3481,8 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
>  {
>  	struct pack_entry e;
>  
> +	if (!startup_info->have_repository)
> +		return 0;

I added have_git_dir(), which catches some other cases (e.g., we have a
$GIT_DIR but just haven't entered the repo _yet_). TBH, I am not
entirely sure when it would be needed, and when checking have_repository
is enough. I added it to make some cases with early config-reading work,
but now that we have Dscho's discover-the-real-repo, I think it would
supersede that use anyway.

So...maybe you'd want it here and maybe not?

-Peff

      reply	other threads:[~2017-04-12  0:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  8:40 What's cooking in git.git (Apr 2017, #01; Tue, 11) Junio C Hamano
2017-04-11 10:12 ` Christian Couder
2017-04-11 22:47 ` Jonathan Nieder
2017-04-12  0:42   ` 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

  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=20170412004258.olfxsdbc3go25s7x@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@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.
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).