From: ZheNing Hu <adlternative@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Christian Couder <christian.couder@gmail.com>,
Hariom verma <hariom18599@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [QUESTION] how to quickly find an oid in the git repository
Date: Mon, 31 May 2021 19:30:35 +0800 [thread overview]
Message-ID: <CAOLTT8Rsy-XRys6fv3EbUJSUbHFCG4=w9uR7Bz8N8u8PWHgPhw@mail.gmail.com> (raw)
In-Reply-To: <YLP7kuFNfVZK+xCK@coredump.intra.peff.net>
Jeff King <peff@peff.net> 于2021年5月31日周一 上午4:54写道:
> > On the other hand, oid_object_info_extended() will parse an object
> > in depth, using it will seriously affect performance. So I want to know
> > if there is a function that can quickly find the oid? I searched in
> > `object-name.c`, `object-file.c`, and there seems to be no clue...
>
> You should be able to use oid_object_info_extended() here. It will try
> to do as little work as possible to fulfill the items requested in the
> object_info struct. So a blank one (or even passing NULL) will return an
> error if the object doesn't exist, but not otherwise.
>
> There's also has_object_file(), which is essentially a wrapper for this.
>
This is exactly what I want. It seems that the real performance problem
is not because of the use of oid_object_info_extended(), but the possible
copy of the object data in it.
> -Peff
Thanks!
--
ZheNing Hu
prev parent reply other threads:[~2021-05-31 11:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-30 6:53 [QUESTION] how to quickly find an oid in the git repository ZheNing Hu
2021-05-30 20:54 ` Jeff King
2021-05-31 11:30 ` ZheNing Hu [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='CAOLTT8Rsy-XRys6fv3EbUJSUbHFCG4=w9uR7Bz8N8u8PWHgPhw@mail.gmail.com' \
--to=adlternative@gmail.com \
--cc=christian.couder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hariom18599@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood123@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).