{"thread":{"id":"64967","subject":"git fetch --dry-run can modify the repo","startedAt":"2026-02-10T05:33:46Z","lastAt":"2026-02-10T07:50:18Z","messageCount":2,"participants":["Tyler Breisacher","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"535649","messageId":"CAGf4dO6QQ+ZG0iWqOY4StM-_UfmH2rZsBjFUcv0ziK5qvbkTHg@mail.gmail.com","threadId":"64967","inReplyTo":null,"subject":"git fetch --dry-run can modify the repo","fromName":"Tyler Breisacher","fromEmail":"matrixfrog@gmail.com","sentAt":"2026-02-10T05:33:33Z","receivedAt":"2026-02-10T05:33:46Z","isPatch":false,"sender":{"key":"matrixfrog@gmail.com","avatar":null},"body":"Interesting bug we came across -- or at least I think it's a bug. In\nany git repo that is not a shallow clone:\n\n$ cat .git/shallow # \"No such file or directory\"\n$ git fetch --depth=1 --dry-run\n$ cat .git/shallow # Prints a git sha\n\nI would think no command should make any changes to the local repo if\n--dry-run is passed.\n\nThanks!\n\nTyler\n"},{"id":"535656","messageId":"20260210075017.GF1756549@coredump.intra.peff.net","threadId":"64967","inReplyTo":"CAGf4dO6QQ+ZG0iWqOY4StM-_UfmH2rZsBjFUcv0ziK5qvbkTHg@mail.gmail.com","subject":"Re: git fetch --dry-run can modify the repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-02-10T07:50:17Z","receivedAt":"2026-02-10T07:50:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 09, 2026 at 09:33:33PM -0800, Tyler Breisacher wrote:\n\n> Interesting bug we came across -- or at least I think it's a bug. In\n> any git repo that is not a shallow clone:\n> \n> $ cat .git/shallow # \"No such file or directory\"\n> $ git fetch --depth=1 --dry-run\n> $ cat .git/shallow # Prints a git sha\n> \n> I would think no command should make any changes to the local repo if\n> --dry-run is passed.\n\nHere's a related thread with some more discussion:\n\n  https://lore.kernel.org/git/CY8PR05MB100119985C7C25A72E530556DB517A@CY8PR05MB10011.namprd05.prod.outlook.com/\n\nThis is intended-ish, as --dry-run does still transfer objects, but just\navoids updating any refs. And if we have shallow'd objects, we have to\nmark them as such (otherwise they appear corrupted).\n\nThere's some discussion in the thread above about whether a truly \"dry\"\nfetch would be a good idea. But short of that, probably the\ndocumentation could stand to be updated.\n\n-Peff\n"}]}