Re: [PATCH 7/8] core.fsync: new option to harden loose references
- From
- Neeraj Singh <nksingh85@gmail.com>
- Date
- Mar 10, 2022, 22:54 UTC
- Message-ID
- <CANQDOddJYNiGY7raZFaMdX-ySSV7xfop9iMXoNG9jKBf5PnqTQ@mail.gmail.com>
- In-Reply-To
- <f1e8a7bb3bf0f4c0414819cb1d5579dc08fd2a4f.1646905589.git.ps@pks.im>
On Thu, Mar 10, 2022 at 1:53 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 58 quoted lines
> diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt
> index 973805e8a9..b67d3c340e 100644
> --- a/Documentation/config/core.txt
> +++ b/Documentation/config/core.txt
> @@ -564,8 +564,10 @@ core.fsync::
> * `pack-metadata` hardens packfile bitmaps and indexes.
> * `commit-graph` hardens the commit graph file.
> * `index` hardens the index when it is modified.
> +* `loose-ref` hardens references modified in the repo in loose-ref form.
> * `objects` is an aggregate option that is equivalent to
> `loose-object,pack`.
> +* `refs` is an aggregate option that is equivalent to `loose-ref`.
> * `derived-metadata` is an aggregate option that is equivalent to
> `pack-metadata,commit-graph`.
> * `default` is an aggregate option that is equivalent to
> diff --git a/cache.h b/cache.h
> index 63a95d1977..b56a56f539 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1005,11 +1005,14 @@ enum fsync_component {
> FSYNC_COMPONENT_PACK_METADATA = 1 << 2,
> FSYNC_COMPONENT_COMMIT_GRAPH = 1 << 3,
> FSYNC_COMPONENT_INDEX = 1 << 4,
> + FSYNC_COMPONENT_LOOSE_REF = 1 << 5,
> };
>
> #define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
> FSYNC_COMPONENT_PACK)
>
> +#define FSYNC_COMPONENTS_REFS (FSYNC_COMPONENT_LOOSE_REF)
> +
> #define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
> FSYNC_COMPONENT_COMMIT_GRAPH)
>
> @@ -1026,7 +1029,8 @@ enum fsync_component {
> FSYNC_COMPONENT_PACK | \
> FSYNC_COMPONENT_PACK_METADATA | \
> FSYNC_COMPONENT_COMMIT_GRAPH | \
> - FSYNC_COMPONENT_INDEX)
> + FSYNC_COMPONENT_INDEX | \
> + FSYNC_COMPONENT_LOOSE_REF)
>
> /*
> * A bitmask indicating which components of the repo should be fsynced.
> diff --git a/config.c b/config.c
> index f03f27c3de..b5d3e6e404 100644
> --- a/config.c
> +++ b/config.c
> @@ -1332,7 +1332,9 @@ static const struct fsync_component_entry {
> { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
> { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
> { "index", FSYNC_COMPONENT_INDEX },
> + { "loose-ref", FSYNC_COMPONENT_LOOSE_REF },
> { "objects", FSYNC_COMPONENTS_OBJECTS },
> + { "refs", FSYNC_COMPONENTS_REFS },
> { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
> { "default", FSYNC_COMPONENTS_DEFAULT },
> { "committed", FSYNC_COMPONENTS_COMMITTED },In terms of the 'preciousness-levels', refs should be included in FSYNC_COMPONENTS_COMMITTED, from which it will also be included in _ADDED.