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

Re: [PATCH 3/6] rerere: tighten rr-cache dirname check

From
Taylor Blau <me@ttaylorr.com>
Date
Jan 28, 2021, 22:35 UTC
Message-ID
<YBM8G/N/Oo1BMWKa@nand.local>
In-Reply-To
<YBJW0gRn9SnP6N9d@coredump.intra.peff.net>
On Thu, Jan 28, 2021 at 01:16:50AM -0500, Jeff King wrote:
Show 7 quoted lines
> Note that "get_sha1_hex()" is a confusing historical name. It is
> actually using the_hash_algo, so it would be sha256 in a sha256 repo.
> We'll switch to using parse_oid_hex(), because that conveniently
> advances our pointer. But it also gets rid of the sha1 name. Arguably
> it's a little funny to use "object_id" here for something that isn't
> actually naming an object, but it's unlikely to be a problem (and is
> contained in a single function).

Not that it matters, but I think the argument would be that having "oid" in the function call probably isn't ideal, but it's closer to the ideal than having "sha1" in the same call (which isn't always the case).

Likewise about advancing the pointer, since everything is pass-by-value, modifying the stack local copy of path doesn't matter to callers of is_rr_cache_dirname().

So I think that this change is an improvement over the status-quo here. Thanks, Taylor

Previous: Jeff KingNext: Jeff King
Message 6 of 15 in “convert hash_pos() to oid_pos()”
  1. 0/6 convert hash_pos() to oid_pos()Jeff King, Jan 28, 2021
  2. 1/6 commit_graft_pos(): take an oid instead of a bare hashJeff King, Jan 28, 2021
  3. Derrick StoleeJan 28, 2021
  4. 2/6 rerere: check dirname format while iterating rr_cache directoryJeff King, Jan 28, 2021
  5. 3/6 rerere: tighten rr-cache dirname checkJeff King, Jan 28, 2021
  6. Taylor BlauJan 28, 2021
  7. Jeff KingJan 28, 2021
  8. Jeff KingJan 28, 2021
  9. Junio C HamanoJan 28, 2021
  10. Junio C HamanoJan 28, 2021
  11. Jeff KingJan 28, 2021
  12. 5/6 hash_pos(): convert to oid_pos()Jeff King, Jan 28, 2021
  13. Taylor BlauJan 28, 2021
  14. Jeff KingJan 29, 2021
  15. 6/6 oid_pos(): access table through const pointersJeff King, Jan 28, 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.