git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Jack Bates <bk874k@nottheoilrig.com>,
	git@vger.kernel.org, Jack Bates <jack@nottheoilrig.com>
Subject: Re: [PATCH] diff: fix up SHA-1 abbreviations outside of repository
Date: Mon, 05 Dec 2016 14:43:46 -0800	[thread overview]
Message-ID: <xmqqmvga2dzx.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161205072614.zg6yglqnznna65vf@sigill.intra.peff.net> (Jeff King's message of "Mon, 5 Dec 2016 02:26:14 -0500")

Jeff King <peff@peff.net> writes:

> I agree that it may be an accident waiting to happen, though, as soon as
> some buried sub-function needs to care about the distinction.

Yes to that.

>> I wonder if we're better off if we made sure that diff_no_index()
>> works the same way regardless of the value of "have_repository"
>> field?
>
> If you mean adding a diffopt flag like "just abbreviate everything to
> FALLBACK_DEFAULT_ABBREV even if we're in a repository", and then setting
> that in diff_no_index(), I agree that is a lot cleaner.

I am not sure if that is what I meant (I no longer sure what exactly
I meant to say there TBH), but this is probably not limited to the
default abbrev length aka core.abbrev configuration.  Don't we have
other configuration settings we may read from $HOME/.gitconfig (and
possibly per-repository .git/config, if we did discovery but were
explicitly given "--no-index") that want to affect the behaviour of
the command?  

I guess what I wanted, with "the same way", to see happen was that
"have_repository" should be only controling how and from what files
the configuration is read, and the behaviour of the command should
be controlled by the values read from the configuration after that.

Specifically, even if we were running with "--no-index", if we know
we have access to the current repository discovered by setting it up
gently, I do not think it is bad to ask find_unique_abbrev() to come
up with an appropriate abbreviation.  So the fact that patch in
question has to flip the have_repository bit off, if it is done in
order to affect what diff_abbrev_oid() does, smells quite fishy from
that point of view.


      parent reply	other threads:[~2016-12-05 22:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-04 19:47 [PATCH] diff: fix up SHA-1 abbreviations outside of repository Jack Bates
2016-12-05  6:55 ` Jeff King
2016-12-05  7:19 ` Junio C Hamano
2016-12-05  7:26   ` Jeff King
2016-12-05 17:45     ` Jack Bates
2016-12-05 22:43     ` Junio C Hamano [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=xmqqmvga2dzx.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=bk874k@nottheoilrig.com \
    --cc=git@vger.kernel.org \
    --cc=jack@nottheoilrig.com \
    --cc=peff@peff.net \
    /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).