git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] git fetch --dry-run --filter makes changes to .git/config

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 17, 2025, 21:21 UTC
Message-ID
<aMsmbU_Cg0L6kOlm@fruit.crustytoothpaste.net>
In-Reply-To
<CY8PR05MB100119985C7C25A72E530556DB517A@CY8PR05MB10011.namprd05.prod.outlook.com>
On 2025-09-17 at 14:44:00, Kevin Puetz wrote:
Show 16 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
>     `git fetch origin --refetch --dry-run {commit} --depth=1 --filter=tree:0 --no-auto-gc`
> 
> What did you expect to happen? (Expected behavior)
> 
>     I expected it to fetch just the one commit object (no blobs, no trees, no history),
>     as a means of checking whether that commit is actually known to the remote.
> 
> What happened instead? (Actual behavior)
> 
>     the .git/config file was modified, adding
> 
>     [remote "origin"]
>         promisor = true
>         partialclonefilter = tree:0

I will note that if this command actually downloads any data, this is required. That's because your repository is incomplete: you want to download exactly one commit and without marking the promisor remote, you will lack the ability to acquire trees or blobs and your repository will then be corrupt.

> What's different between what you expected and what actually happened?
> 
>     I did not expect any changes to the local clone (due to the use of --dry-run)

I agree --dry-run should not change your repository. However, I would also say that it should not contact the server, either, so it may not do what you want. If that's not what it was intended to do, perhaps someone can clarify the documentation as to its functionality.

Show 8 quoted lines
> Anything else you want to add:
> 
>     Context is https://github.com/conan-io/conan/issues/18949
> 
> 
>     trying to avoid a full-re-download in the process of checking
>     whether the HEAD commit hash exists in a remote.
>     The command was expected to either be a no-op success, or fail

I don't think that the command you've provided is a good or efficient way of doing what you want, but I'm also not sure that there's a good or efficient way to do what you want using command line Git (you might need to write a small portion of the protocol, for instance).

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Kevin PuetzNext: Kevin Puetz
Message 2 of 10 in “[Bug] git fetch --dry-run --filter makes changes to .git/config”
  1. Kevin PuetzSep 17, 2025
  2. brian m. carlsonSep 17, 2025
  3. Kevin PuetzSep 17, 2025
  4. Jeff KingSep 18, 2025
  5. Junio C HamanoSep 18, 2025
  6. Jeff KingSep 18, 2025
  7. Junio C HamanoSep 18, 2025
  8. Kevin PuetzSep 18, 2025
  9. rsbecker@nexbridge.comSep 18, 2025
  10. Kevin PuetzSep 19, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.