From: Junio C Hamano <gitster@pobox.com>
To: Tim Hockin <thockin@google.com>
Cc: git@vger.kernel.org
Subject: Re: git fetch --dry-run changes the local repo and transfers data
Date: Tue, 27 Dec 2022 21:52:48 +0900 [thread overview]
Message-ID: <xmqqcz85t3dr.fsf@gitster.g> (raw)
In-Reply-To: CAO_RewZeUBVvqT+UgXL5V5EeTOt14zZ-5vJYA4YvNr-jNyupXg@mail.gmail.com
Tim Hockin <thockin@google.com> writes:
> I'm trying to test if a remote repo has a given SHA. `ls-remote` does
> not work for this unless it is a tag or a HEAD (which is not
> guaranteed for this case).
>
> `git fetch --dry-run $remote $rev` SEEMS to fit the bill, except it
> changes local state. For example:
Well, without changing the "local state", you cannot see if that
report repository has or does not have the commit.
> FETCH_HEAD was not updated (good)
None of your refs are updated, either.
There are things that are not reachable from your refs (or other
anchoring points like the index and the reflog). As far as Git is
concerned, they don't exist [*], and that is why Git will happily
remove them with "git gc", for example. They are crufts and it is
easier to think of them as not a part of "local data".
So I suspect that ...
> but the rev in question is now
> present locally (bad),
... this complaint is a bit misguided. After all, the procdure you
gave above is exactly how you would ask the "I'm trying to test if a
remote repo has a given SHA" question about commit f80f1b23b4ca. If
the operation did not transfer data, you would not be able to get
the answer to that question.
> Am I using --dry-run wrong (or misunderstanding its purpose)?
Maybe (mis)understanding on Git's data model (see above [*]) is the
root cause of this confusion.
next prev parent reply other threads:[~2022-12-27 12:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 17:21 git fetch --dry-run changes the local repo and transfers data Tim Hockin
2022-12-27 12:52 ` Junio C Hamano [this message]
2022-12-27 18:42 ` Tim Hockin
2023-01-03 11:07 ` 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=xmqqcz85t3dr.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=thockin@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.