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

Re: [PATCH v2 17/29] packed_ref_store: support iteration

From
Jeff King <peff@peff.net>
Date
Jun 23, 2017, 19:12 UTC
Message-ID
<20170623191224.s5rkaruv6npbds7q@sigill.intra.peff.net>
In-Reply-To
<4171c4ea8b0280fa2c8cee9f1799933f66894f74.1498200513.git.mhagger@alum.mit.edu>
On Fri, Jun 23, 2017 at 09:01:35AM +0200, Michael Haggerty wrote:
> +static int packed_ref_iterator_advance(struct ref_iterator *ref_iterator)
> +{
> +	struct packed_ref_iterator *iter =
> +		(struct packed_ref_iterator *)ref_iterator;

I thought had some kind of safe downcasting mechanism for iterators, but I think I was just thinking of files_downcast() for the ref-store.

I don't mind not having that kind of safety. It seems like an uncommon error to call the packed-ref iterator function on the wrong type, especially as it's static here and only accessible as a virtual function for a packed_ref_iterator.

But something to think about, I guess, as we add more polymorphism.
-Peff
Previous: Michael HaggertyNext: Michael Haggerty
Message 16 of 52 in “Create a reference backend for packed refs”
  1. 00/29 Create a reference backend for packed refsMichael Haggerty, Jun 23, 2017
  2. 01/29 t1408: add a test of stale packed refs covered by loose refsMichael Haggerty, Jun 23, 2017
  3. Jeff KingJun 23, 2017
  4. Junio C HamanoJun 23, 2017
  5. 02/29 add_packed_ref(): teach function to overwrite existing refsMichael Haggerty, Jun 23, 2017
  6. 07/29 validate_packed_ref_cache(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  7. 05/29 packed_ref_store: move `packed_refs_lock` member hereMichael Haggerty, Jun 23, 2017
  8. 03/29 packed_ref_store: new structMichael Haggerty, Jun 23, 2017
  9. 09/29 get_packed_refs(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  10. 04/29 packed_ref_store: move `packed_refs_path` hereMichael Haggerty, Jun 23, 2017
  11. 13/29 rollback_packed_refs(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  12. 12/29 commit_packed_refs(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  13. 14/29 get_packed_ref(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  14. 06/29 clear_packed_ref_cache(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  15. 17/29 packed_ref_store: support iterationMichael Haggerty, Jun 23, 2017
  16. Jeff KingJun 23, 2017
  17. 16/29 packed_peel_ref(): new function, extracted from `files_peel_ref()`Michael Haggerty, Jun 23, 2017
  18. 19/29 packed-backend: new module for handling packed referencesMichael Haggerty, Jun 23, 2017
  19. Jeff KingJun 23, 2017
  20. Stefan BellerJun 23, 2017
  21. Junio C HamanoJun 23, 2017
  22. 20/29 packed_ref_store: make class into a subclass of `ref_store`Michael Haggerty, Jun 23, 2017
  23. Jeff KingJun 23, 2017
  24. 21/29 commit_packed_refs(): report errors rather than dyingMichael Haggerty, Jun 23, 2017
  25. 22/29 commit_packed_refs(): use a staging file separate from the lockfileMichael Haggerty, Jun 23, 2017
  26. Jeff KingJun 23, 2017
  27. Michael HaggertyJun 24, 2017
  28. Jeff KingJun 24, 2017
  29. 24/29 packed_refs_lock(): report errors via a `struct strbuf *err`Michael Haggerty, Jun 23, 2017
  30. 26/29 clear_packed_ref_cache(): don't protest if the lock is heldMichael Haggerty, Jun 23, 2017
  31. Jeff KingJun 23, 2017
  32. 25/29 packed_refs_unlock(), packed_refs_is_locked(): new functionsMichael Haggerty, Jun 23, 2017
  33. 23/29 packed_refs_lock(): function renamed from lock_packed_refs()Michael Haggerty, Jun 23, 2017
  34. 28/29 repack_without_refs(): don't lock or unlock the packed refsMichael Haggerty, Jun 23, 2017
  35. Jeff KingJun 23, 2017
  36. Michael HaggertyJul 1, 2017
  37. 27/29 commit_packed_refs(): remove call to `packed_refs_unlock()`Michael Haggerty, Jun 23, 2017
  38. Jeff KingJun 23, 2017
  39. 29/29 read_packed_refs(): die if `packed-refs` contains bogus dataMichael Haggerty, Jun 23, 2017
  40. Jeff KingJun 23, 2017
  41. Michael HaggertyJul 1, 2017
  42. 11/29 lock_packed_refs(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  43. 10/29 add_packed_ref(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  44. 15/29 repack_without_refs(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  45. 18/29 packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`Michael Haggerty, Jun 23, 2017
  46. 08/29 get_packed_ref_cache(): take a `packed_ref_store *` parameterMichael Haggerty, Jun 23, 2017
  47. Jeff KingJun 23, 2017
  48. Jeff KingJun 23, 2017
  49. Junio C HamanoJun 23, 2017
  50. Jeff KingJun 24, 2017
  51. Michael HaggertyJun 24, 2017
  52. Junio C HamanoJun 23, 2017

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.