git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: git <git@vger.kernel.org>
Subject: Determining whether you have a commit locally, in a partial clone?
Date: Tue, 20 Jun 2023 13:26:29 +0200	[thread overview]
Message-ID: <CAPMMpohiTzANyhzL-mS-gg2kzbOEOiDktNbdwEXBKy9uL0-JgA@mail.gmail.com> (raw)

Hi folks,

I "discovered" today that when you're in a partial clone, naive tests
to check for whether you have a commit locally no longer work - they
fetch the commit on-demand:

git cat-file -t SOME_HASH_NOT_IN_REFSPEC
git rev-list SOME_HASH_NOT_IN_REFSPEC

I didn't realize this until today: even commits can be "filtered out"
by partial clone, so any reference to a commit that is not found
locally must be resolved transparently via jit-fetch.

I'm optimizing some stuff for users, so I need to know whether a given
commit exists locally or not... but I can't seem to figure out how!

I tried using "git rev-list"'s "--exclude-promisor-objects" option,
but I guess I don't understand what that's supposed to do. In my case
it just made a simple check like "git rev-list
--exclude-promisor-objects SOME_HASH_NOT_IN_REFSPEC" take forever (10
mins and counting).

I confirmed that removing (commenting out) the
"remote.origin.promisor" and "remote.origin.partialclonefilter" config
keys achieves my objective, but I can't figure out how to do it
safely; "-c remote.origin.promisor=false -c
remote.origin.partialclonefilter=" does *not* seem to work. The
existence of a "remote.origin.partialclonefilter" value, even if it is
empty, appears to override the "remote.origin.promisor=false" setting.

As far as I can tell, config values cannot be unset with "-c" - in
fact I see that credential.helper was granted special support for
empty string as a way of signalling "no credential helper" by Jeff
King in 2016.

So I guess I have two questions:
* Is there any way to run a single git command in a "don't use
promisors" context?
* Is the fact that "-c remote.origin.partialclonefilter=" doesn't work
for temporarily unsetting the filter a bug/issue to be resolved?

Thanks,
Tao

             reply	other threads:[~2023-06-20 11:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 11:26 Tao Klerks [this message]
2023-06-20 12:04 ` Determining whether you have a commit locally, in a partial clone? Tao Klerks
2023-06-20 18:31   ` Junio C Hamano
2023-06-20 19:41     ` Tao Klerks
2023-06-21  6:54     ` Jeff King
2023-06-20 19:12   ` Tao Klerks
2023-06-21  6:44     ` Jeff King
2023-06-21 10:10       ` Tao Klerks
2023-06-27  8:09         ` 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

  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=CAPMMpohiTzANyhzL-mS-gg2kzbOEOiDktNbdwEXBKy9uL0-JgA@mail.gmail.com \
    --to=tao@klerks.biz \
    --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).