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

Re: [PATCH] add: don't write objects with --dry-run

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 12, 2021, 20:37 UTC
Message-ID
<xmqqfst62d4u.fsf@gitster.g>
In-Reply-To
<871r4qj8mw.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 11 quoted lines
> I think the "git fetch --dry-run" command behaves like this too,
> i.e. doesn't update refs, but fetches and writes objects.
>
> For the patch I hacked up I think it's easy to argue that it shouldn't
> do compression etc.
>
> For this sort of thing and "fetch" I'm not so sure. Do we really know
> that there aren't people who rely on this for say the performance of
> seeing what an operation would do, and then not pay as much for the
> "real one" that updates the index/refs/etc. later? Is that subsequent
> "fetch" cheaper because of the --dry-run?

The answer to the last one is an easy "yes". Trying to gauge the time it would take for a real fetch with "--dry-run" is a losing battle, I would think, as the pre-fetching would make the "real" one cheaper, so from that point of view, I think we can ignore those who time "--dry-run" and try to figure out anything meaningful.

This in any case is an interesting area, as the definition of correctness of what "dry-run" does can be quite fuzzy. As long as it does not change the index, "git add --dry-run", even if it writes objects or detects filesystem corruption by noticing I/O error while compressing the data taken from the working tree files, is still correct and the patch in question is not technically a bugfix (it is a performance thing). "git fetch --dry-run" would fall into the same category, so would "git hash-object" without "-w".

All can use performance enhancement without breaking existing users, I would think.

Thanks.
Previous: Ævar Arnfjörð Bjarmason
Message 5 of 5 in “[BUG] git add -A --dry-run adds files to .git directory”
  1. git.mexon@spamgourmet.comOct 12, 2021
  2. add: don't write objects with --dry-runRené Scharfe, Oct 12, 2021
  3. Junio C HamanoOct 12, 2021
  4. Ævar Arnfjörð BjarmasonOct 12, 2021
  5. Junio C HamanoOct 12, 2021

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.