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

Re: [PATCH v1] hash: handle invalid algorithms when formatting object IDs

From
TJTanga Joris <tangajoris@gmail.com>
Date
Nov 5, 2026, 14:47 UTC
Message-ID
<CAKrRMNrLvPck5psPpKX1eWe26To5srfFSLFObZ4zTX09RE551w@mail.gmail.com>
In-Reply-To
<20261103043756.61627-1-eddinen77@gmail.com>
Hello shrimech,
Thank you for the patch.

I tried it on top of master (0ffa3e35c7). "cargo test" passes, and the new test fails without your change to fmt(), so it does catch the problem.

On Tue, 3 Nov 2026 at 07:42, shrimech <eddinen77@gmail.com> wrote:
> +            Err(e) => write!(f, ":invalid-hash-algo-{}", e.0),

I have one question. In the C code, algo 0 is not treated as an error when printing: hash_to_hex_algop_r() in hex.c falls back to the default hash ("Our struct object_id has been memset to 0, so default to printing using the default hash"). Your test uses algo 0 as the invalid case, so for algo 0 the Rust output would be different from C. Is that intended?

brian m. carlson wrote most of src/hash.rs, so I have added him on Cc, I hope that is okay:)

Also the first patch versions can be sent as [PATCH] instead of [PATCH v1]. Either way works. The v1 format is less common though.

Thanks, Tanga

Previous: shrimechNext: brian m. carlson
Message 2 of 5 in “hash: handle invalid algorithms when formatting object IDs”
  1. hash: handle invalid algorithms when formatting object IDsshrimech, Nov 3, 2026
  2. Tanga JorisNov 5, 2026
  3. brian m. carlsonNov 6, 2026
  4. Tanga JorisNov 7, 2026
  5. brian m. carlsonNov 9, 2026

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.