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

[PATCH v2 00/33] Various cleanups around reference packing and peeling

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Apr 22, 2013, 19:52 UTC
Message-ID
<1366660361-21831-1-git-send-email-mhagger@alum.mit.edu>

Thanks for the feedback; here is a re-roll. A number of points discussed on the mailing list were fixed. The main change, in patch 17, is how repack_without_ref() deals with references that cannot be peeled when re-writing the packed-refs file:

if ISBROKEN:
    emit an error and omit reference from the output
else if !has_sha1_file(...):
    if there is an overriding loose reference:
        silently omit reference from the output
    else:
        emit an error and omit reference from the output

Please note that this creates a relatively harmless race condition very similar to the ones discussed for pack-refs; see the commit message for patch 17 for a long explanation. I would like to fix all of the races as part of a separate patch series.

For now I left the sleeps in t3210. Given that the problem will be solved by topic jc/prune-all, building a fancier workaround into this test for the old broken --expire behavior seems like a waste of time. I propose that the sleeps be removed when this patch series is merged with jc/prune-all. (In fact, when jc/prune-all is landed, other tests can also be simplified.) If this suggestion is not ok, then the easiest thing would probably be to remove the sleeps immediately and declare jc/prune-all a prerequisite of this series.

I also removed the trailing comma from the "enum peel_status" definition, because a recent email on the mailing list claimed that some compilers don't like them.

Michael Haggerty (33):
  refs: document flags constants REF_*
  refs: document the fields of struct ref_value
  refs: document do_for_each_ref() and do_one_ref()
  refs: document how current_ref is used
  refs: define constant PEELED_LINE_LENGTH
  do_for_each_ref_in_dirs(): remove dead code
  get_packed_ref(): return a ref_entry
  peel_ref(): use function get_packed_ref()
  repack_without_ref(): use function get_packed_ref()
  refs: extract a function ref_resolves_to_object()
  refs: extract function peel_object()
  peel_object(): give more specific information in return value
  peel_ref(): fix return value for non-peelable, not-current reference
  refs: extract a function peel_entry()
  refs: change the internal reference-iteration API
  t3210: test for spurious error messages for dangling packed refs
  repack_without_ref(): silence errors for dangling packed refs
  search_ref_dir(): return an index rather than a pointer
  refs: change how packed refs are deleted
  t3211: demonstrate loss of peeled refs if a packed ref is deleted
  repack_without_ref(): write peeled refs in the rewritten file
  refs: extract a function write_packed_entry()
  pack-refs: rename handle_one_ref() to pack_one_ref()
  pack-refs: merge code from pack-refs.{c,h} into refs.{c,h}
  pack_one_ref(): rename "path" parameter to "refname"
  refs: use same lock_file object for both ref-packing functions
  pack_refs(): change to use do_for_each_entry()
  refs: inline function do_not_prune()
  pack_one_ref(): use function peel_entry()
  pack_one_ref(): use write_packed_entry() to do the writing
  pack_one_ref(): do some cheap tests before a more expensive one
  refs: change do_for_each_*() functions to take ref_cache arguments
  refs: handle the main ref_cache specially
 Makefile             |   2 -
 builtin/clone.c      |   1 -
 builtin/pack-refs.c  |   2 +-
 pack-refs.c          | 148 -----------
 pack-refs.h          |  18 --
 refs.c               | 733 +++++++++++++++++++++++++++++++++++++++------------
 refs.h               |  35 +++
 t/t3210-pack-refs.sh |  36 +++
 t/t3211-peel-ref.sh  |   9 +
 9 files changed, 643 insertions(+), 341 deletions(-)
 delete mode 100644 pack-refs.c
 delete mode 100644 pack-refs.h
-- 
1.8.2.1
Next: Michael Haggerty
Message 1 of 40 in “Various cleanups around reference packing and peeling”
  1. 00/33 Various cleanups around reference packing and peelingMichael Haggerty, Apr 22, 2013
  2. 01/33 refs: document flags constants REF_*Michael Haggerty, Apr 22, 2013
  3. 02/33 refs: document the fields of struct ref_valueMichael Haggerty, Apr 22, 2013
  4. 03/33 refs: document do_for_each_ref() and do_one_ref()Michael Haggerty, Apr 22, 2013
  5. 04/33 refs: document how current_ref is usedMichael Haggerty, Apr 22, 2013
  6. 05/33 refs: define constant PEELED_LINE_LENGTHMichael Haggerty, Apr 22, 2013
  7. 06/33 do_for_each_ref_in_dirs(): remove dead codeMichael Haggerty, Apr 22, 2013
  8. 07/33 get_packed_ref(): return a ref_entryMichael Haggerty, Apr 22, 2013
  9. 08/33 peel_ref(): use function get_packed_ref()Michael Haggerty, Apr 22, 2013
  10. 09/33 repack_without_ref(): use function get_packed_ref()Michael Haggerty, Apr 22, 2013
  11. 10/33 refs: extract a function ref_resolves_to_object()Michael Haggerty, Apr 22, 2013
  12. 11/33 refs: extract function peel_object()Michael Haggerty, Apr 22, 2013
  13. 12/33 peel_object(): give more specific information in return valueMichael Haggerty, Apr 22, 2013
  14. 13/33 peel_ref(): fix return value for non-peelable, not-current referenceMichael Haggerty, Apr 22, 2013
  15. 14/33 refs: extract a function peel_entry()Michael Haggerty, Apr 22, 2013
  16. 15/33 refs: change the internal reference-iteration APIMichael Haggerty, Apr 22, 2013
  17. 16/33 t3210: test for spurious error messages for dangling packed refsMichael Haggerty, Apr 22, 2013
  18. 17/33 repack_without_ref(): silence errors for dangling packed refsMichael Haggerty, Apr 22, 2013
  19. Junio C HamanoApr 22, 2013
  20. 18/33 search_ref_dir(): return an index rather than a pointerMichael Haggerty, Apr 22, 2013
  21. 19/33 refs: change how packed refs are deletedMichael Haggerty, Apr 22, 2013
  22. 20/33 t3211: demonstrate loss of peeled refs if a packed ref is deletedMichael Haggerty, Apr 22, 2013
  23. 21/33 repack_without_ref(): write peeled refs in the rewritten fileMichael Haggerty, Apr 22, 2013
  24. 22/33 refs: extract a function write_packed_entry()Michael Haggerty, Apr 22, 2013
  25. 23/33 pack-refs: rename handle_one_ref() to pack_one_ref()Michael Haggerty, Apr 22, 2013
  26. 24/33 pack-refs: merge code from pack-refs.{c,h} into refs.{c,h}Michael Haggerty, Apr 22, 2013
  27. 25/33 pack_one_ref(): rename "path" parameter to "refname"Michael Haggerty, Apr 22, 2013
  28. 26/33 refs: use same lock_file object for both ref-packing functionsMichael Haggerty, Apr 22, 2013
  29. 27/33 pack_refs(): change to use do_for_each_entry()Michael Haggerty, Apr 22, 2013
  30. 28/33 refs: inline function do_not_prune()Michael Haggerty, Apr 22, 2013
  31. 29/33 pack_one_ref(): use function peel_entry()Michael Haggerty, Apr 22, 2013
  32. 30/33 pack_one_ref(): use write_packed_entry() to do the writingMichael Haggerty, Apr 22, 2013
  33. 31/33 pack_one_ref(): do some cheap tests before a more expensive oneMichael Haggerty, Apr 22, 2013
  34. 32/33 refs: change do_for_each_*() functions to take ref_cache argumentsMichael Haggerty, Apr 22, 2013
  35. 33/33 refs: handle the main ref_cache speciallyMichael Haggerty, Apr 22, 2013
  36. Junio C HamanoApr 22, 2013
  37. fixup! t3210: test for spurious error messages for dangling packed refsMichael Haggerty, Apr 23, 2013
  38. Junio C HamanoApr 23, 2013
  39. Michael HaggertyApr 24, 2013
  40. Michael HaggertyApr 27, 2013

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.