From: Jeff King <peff@peff•net>
To: Tyler Breisacher <matrixfrog@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: git fetch --dry-run can modify the repo
Date: Tue, 10 Feb 2026 02:50:17 -0500 [thread overview]
Message-ID: <20260210075017.GF1756549@coredump.intra.peff.net> (raw)
In-Reply-To: <CAGf4dO6QQ+ZG0iWqOY4StM-_UfmH2rZsBjFUcv0ziK5qvbkTHg@mail.gmail.com>
On Mon, Feb 09, 2026 at 09:33:33PM -0800, Tyler Breisacher wrote:
> Interesting bug we came across -- or at least I think it's a bug. In
> any git repo that is not a shallow clone:
>
> $ cat .git/shallow # "No such file or directory"
> $ git fetch --depth=1 --dry-run
> $ cat .git/shallow # Prints a git sha
>
> I would think no command should make any changes to the local repo if
> --dry-run is passed.
Here's a related thread with some more discussion:
https://lore.kernel.org/git/CY8PR05MB100119985C7C25A72E530556DB517A@CY8PR05MB10011.namprd05.prod.outlook.com/
This is intended-ish, as --dry-run does still transfer objects, but just
avoids updating any refs. And if we have shallow'd objects, we have to
mark them as such (otherwise they appear corrupted).
There's some discussion in the thread above about whether a truly "dry"
fetch would be a good idea. But short of that, probably the
documentation could stand to be updated.
-Peff
prev parent reply other threads:[~2026-02-10 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 5:33 git fetch --dry-run can modify the repo Tyler Breisacher
2026-02-10 7:50 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210075017.GF1756549@coredump.intra.peff.net \
--to=peff@peff$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=matrixfrog@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox