Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0413b31ddcce6ae6ffaff0a30a67ffbd1a7c648
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d6fc6fe6f8b74e663d6013f830b535f50bfc1414
Choose a head ref
  • 19 commits
  • 29 files changed
  • 2 contributors

Commits on Feb 23, 2026

  1. Merge branch 'ps/odb-for-each-object' into ps/odb-sources

    * ps/odb-for-each-object:
      odb: drop unused `for_each_{loose,packed}_object()` functions
      reachable: convert to use `odb_for_each_object()`
      builtin/pack-objects: use `packfile_store_for_each_object()`
      odb: introduce mtime fields for object info requests
      treewide: drop uses of `for_each_{loose,packed}_object()`
      treewide: enumerate promisor objects via `odb_for_each_object()`
      builtin/fsck: refactor to use `odb_for_each_object()`
      odb: introduce `odb_for_each_object()`
      packfile: introduce function to iterate through objects
      packfile: extract function to iterate through objects of a store
      object-file: introduce function to iterate through objects
      object-file: extract function to read object info from path
      odb: fix flags parameter to be unsigned
      odb: rename `FOR_EACH_OBJECT_*` flags
    gitster committed Feb 23, 2026
    Configuration menu
    Copy the full SHA
    703c975 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'ps/object-info-bits-cleanup' into ps/odb-sources

    * ps/object-info-bits-cleanup:
      odb: convert `odb_has_object()` flags into an enum
      odb: convert object info flags into an enum
      odb: drop gaps in object info flag values
      builtin/fsck: fix flags passed to `odb_has_object()`
      builtin/backfill: fix flags passed to `odb_has_object()`
    gitster committed Feb 23, 2026
    Configuration menu
    Copy the full SHA
    b1af291 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2026

  1. odb: split struct odb_source into separate header

    Subsequent commits will expand the `struct odb_source` to become a
    generic interface for accessing an object database source. As part of
    these refactorings we'll add a set of function pointers that will
    significantly expand the structure overall.
    
    Prepare for this by splitting out the `struct odb_source` into a
    separate header. This keeps the high-level object database interface
    detached from the low-level object database sources.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    ba1c21d View commit details
    Browse the repository at this point in the history
  2. odb: introduce "files" source

    Introduce a new "files" object database source. This source encapsulates
    access to both loose object files and the packfile store, similar to how
    the "files" backend for refs encapsulates access to loose refs and the
    packed-refs file.
    
    Note that for now the "files" source is still a direct member of a
    `struct odb_source`. This architecture will be reversed in the next
    commit so that the files source contains a `struct odb_source`.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    cb506a8 View commit details
    Browse the repository at this point in the history
  3. odb: embed base source in the "files" backend

    The "files" backend is implemented as a pointer in the `struct
    odb_source`. This contradicts our typical pattern for pluggable backends
    like we use it for example in the ref store or for object database
    streams, where we typically embed the generic base structure in the
    specialized implementation. This pattern has a couple of small benefits:
    
      - We avoid an extra allocation.
    
      - We hide implementation details in the generic structure.
    
      - We can easily downcast from a generic backend to the specialized
        structure and vice versa because the offsets are known at compile
        time.
    
      - It becomes trivial to identify locations where we depend on backend
        specific logic because the cast needs to be explicit.
    
    Refactor our "files" object database source to do the same and embed the
    `struct odb_source` in the `struct odb_source_files`.
    
    There are still a bunch of sites in our code base where we do have to
    access internals of the "files" backend. The intent is that those will
    go away over time, but this will certainly take a while. Meanwhile,
    provide a `odb_source_files_downcast()` function that can convert a
    generic source into a "files" source.
    
    As we only have a single source the downcast succeeds unconditionally
    for now. Eventually though the intent is to make the cast `BUG()` in
    case the caller requests to downcast a non-"files" backend to a "files"
    backend.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    d9ecf26 View commit details
    Browse the repository at this point in the history
  4. odb: move reparenting logic into respective subsystems

    The primary object database source may be initialized with a relative
    path. When the process changes its current working directory we thus
    have to update this path and have it point to the same path, but
    relative to the new working directory.
    
    This logic is handled in the object database layer. It consists of three
    steps:
    
      1. We undo any potential temporary object directory, which are used
         for transactions. This is done so that we don't end up modifying
         the temporary object database source that got applied for the
         transaction.
    
      2. We then iterate through the non-transactional sources and reparent
         their respective paths.
    
      3. We reapply the temporary object directory, but update its path.
    
    All of this logic is heavily tied to how the object database source
    handles paths in the first place. It's an internal implementation
    detail, and as sources may not even use an on-disk path at all it is not
    a mechanism that applies to all potential sources.
    
    Refactor the code so that the logic to reparent the sources is hosted by
    the "files" source and the temporary object directory subsystems,
    respectively. This logic is easier to reason about, but it also ensures
    that this logic is handled at the correct level.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    7e0aa0a View commit details
    Browse the repository at this point in the history
  5. odb/source: introduce source type for robustness

    When a caller holds a `struct odb_source`, they have no way of telling
    what type the source is. This doesn't really cause any problems in the
    current status quo as we only have a single type anyway, "files". But
    going forward we expect to add more types, and if so it will become
    necessary to tell the sources apart.
    
    Introduce a new enum to cover this use case and assert that the given
    source actually matches the target source when performing the downcast.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    87842f6 View commit details
    Browse the repository at this point in the history
  6. odb/source: make free() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    47b9650 View commit details
    Browse the repository at this point in the history
  7. odb/source: make reprepare() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    05151cf View commit details
    Browse the repository at this point in the history
  8. odb/source: make close() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    3bc3177 View commit details
    Browse the repository at this point in the history
  9. odb/source: make read_object_info() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Note that this function is a bit less straight-forward to convert
    compared to the other functions. The reason here is that the logic to
    read an object is:
    
      1. We try to read the object. If it exists we return it.
    
      2. If the object does not exist we reprepare the object database
         source.
    
      3. We then try reading the object info a second time in case the
         reprepare caused it to appear.
    
    The second read is only supposed to happen for the packfile store
    though, as reading loose objects is not impacted by repreparing the
    object database.
    
    Ideally, we'd just move this whole logic into the ODB source. But that's
    not easily possible because we try to avoid the reprepare unless really
    required, which is after we have found out that no other ODB source
    contains the object, either. So the logic spans across multiple ODB
    sources, and consequently we cannot move it into an individual source.
    
    Instead, introduce a new flag `OBJECT_INFO_SECOND_READ` that tells the
    backend that we already tried to look up the object once, and that this
    time around the ODB source should try to find any new objects that may
    have surfaced due to an on-disk change.
    
    With this flag, the "files" backend can trivially skip trying to re-read
    the object as a loose object. Furthermore, as we know that we only try
    the second read via the packfile store, we can skip repreparing loose
    objects and only reprepare the packfile store.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    5946a56 View commit details
    Browse the repository at this point in the history
  10. odb/source: make read_object_stream() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    1f3fd68 View commit details
    Browse the repository at this point in the history
  11. odb/source: make for_each_object() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    fdefdc2 View commit details
    Browse the repository at this point in the history
  12. odb/source: make freshen_object() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    6a38b13 View commit details
    Browse the repository at this point in the history
  13. odb/source: make write_object() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    6e76c3a View commit details
    Browse the repository at this point in the history
  14. odb/source: make write_object_stream() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    fc7fb0e View commit details
    Browse the repository at this point in the history
  15. odb/source: make read_alternates() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    7ae2363 View commit details
    Browse the repository at this point in the history
  16. odb/source: make write_alternate() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    eb9635d View commit details
    Browse the repository at this point in the history
  17. odb/source: make begin_transaction() function pluggable

    Introduce a new callback function in `struct odb_source` to make the
    function pluggable.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Mar 5, 2026
    Configuration menu
    Copy the full SHA
    d6fc6fe View commit details
    Browse the repository at this point in the history
Loading