* git fetch --dry-run can modify the repo
@ 2026-02-10 5:33 Tyler Breisacher
2026-02-10 7:50 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Tyler Breisacher @ 2026-02-10 5:33 UTC (permalink / raw)
To: git
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.
Thanks!
Tyler
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: git fetch --dry-run can modify the repo
2026-02-10 5:33 git fetch --dry-run can modify the repo Tyler Breisacher
@ 2026-02-10 7:50 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2026-02-10 7:50 UTC (permalink / raw)
To: Tyler Breisacher; +Cc: git
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-10 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 5:33 git fetch --dry-run can modify the repo Tyler Breisacher
2026-02-10 7:50 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox