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

Re: [PATCH 04/10] builtin/fsck: don't check alternates with "--no-full"

From
Karthik Nayak <karthik.188@gmail.com>
Date
Aug 27, 2026, 10:12 UTC
Message-ID
<CAOLa=ZThFKpbmifU-zScXqiT1QSQqCTppHWbgSqmpRft8K+0XQ@mail.gmail.com>
In-Reply-To
<20260825-pks-odb-source-fsck-v1-4-b756de0bf24f@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 17 quoted lines
> According to git-fsck(1), the "--full" option behaves in the following
> way:
>
>   Check not just objects in GIT_OBJECT_DIRECTORY ($GIT_DIR/objects), but
>   also the ones found in alternate object pools listed in
>   GIT_ALTERNATE_OBJECT_DIRECTORIES or $GIT_DIR/objects/info/alternates,
>   and in packed Git archives found in $GIT_DIR/objects/pack and
>   corresponding pack subdirectories in alternate object pools.
>
> So ultimately, it is supposed to control two things: (1) whether we only
> check the main object directory, and (2) whether we check packfiles.
>
> In its current state though, the flag only controls whether we check
> packfiles or not, and if so we verify packfiles of all attached sources.
> But we also have checks for loose objects in git-fsck(1), and here we
> unconditionally check them in all sources.
>
To reiterate,
without '--full': Check local loose + alternate loose. No packed objects

with '--full': Check local loose + alternate loose. local packed + alternates packed.

And we want to only do local loose in the latter. Makes sense.
Show 36 quoted lines
>
> The flag is arguably conflating two unrelated concerns with one another,
> and it really should be split up into two flags: one that controls how
> thorough we want to check individual sources, and one that controls
> which sources we want to check in the first place. So ideally, we would
> have:
>
>   - "--include-alternates": check all sources, not only the local one.
>
>   - "--include-optimized-objects": check not only loose objects, but
>     also those that have been packed. Note that we explicitly don't say
>     "--include-packed-objects" here to be more backend-agnostic.
>
>   - "--full": implies both of the above flags.
>
> This feels out of scope for this series though. So for now, simply fix
> the code by honoring locality of the sources for loose objects.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  builtin/fsck.c  | 3 ++-
>  t/t1450-fsck.sh | 5 +++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/fsck.c b/builtin/fsck.c
> index 5132ff0f15..3f6056535f 100644
> --- a/builtin/fsck.c
> +++ b/builtin/fsck.c
> @@ -1047,7 +1047,8 @@ int cmd_fsck(int argc,
>  				    mark_object_for_connectivity, repo, 0);
>  	} else {
>  		for (source = repo->objects->sources; source; source = source->next)
> -			fsck_source(repo, source);
> +			if (check_full || source->local)
> +				fsck_source(repo, source);
>
So we check the local bit and only fsck that source. Looks good.
Show 21 quoted lines
>  		if (check_full) {
>  			struct packed_git *p;
> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
> index 77cd96de78..1b4074304c 100755
> --- a/t/t1450-fsck.sh
> +++ b/t/t1450-fsck.sh
> @@ -844,6 +844,11 @@ test_expect_success 'alternate objects are correctly blamed' '
>  	echo "../../alt.git/objects" >.git/objects/info/alternates &&
>  	mkdir alt.git/objects/$(dirname $path) &&
>  	>alt.git/objects/$(dirname $path)/$(basename $path) &&
> +
> +	# Without "--full", only the local object source is checked.
> +	git fsck --no-full >out 2>&1 &&
> +	test_must_be_empty out &&
> +
>  	test_must_fail git fsck >out 2>&1 &&
>  	test_grep alt.git out
>  '
>
> --
> 2.55.0.822.g20453c30eb.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 11 of 54 in “odb: make consistency checks pluggable”
  1. 00/10 odb: make consistency checks pluggablePatrick Steinhardt, Aug 25, 2026
  2. 01/10 builtin/fsck: use `fsck_obj_buffer()` when checking loose objectsPatrick Steinhardt, Aug 25, 2026
  3. Karthik NayakAug 27, 2026
  4. Patrick SteinhardtAug 31, 2026
  5. 02/10 builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()`Patrick Steinhardt, Aug 25, 2026
  6. Karthik NayakAug 27, 2026
  7. Patrick SteinhardtAug 31, 2026
  8. 03/10 builtin/fsck: de-globalize option handlingPatrick Steinhardt, Aug 25, 2026
  9. Karthik NayakAug 27, 2026
  10. 04/10 builtin/fsck: don't check alternates with "--no-full"Patrick Steinhardt, Aug 25, 2026
  11. Karthik NayakAug 27, 2026
  12. Patrick SteinhardtAug 31, 2026
  13. 05/10 odb: provide infrastructure for pluggable fsck checksPatrick Steinhardt, Aug 25, 2026
  14. Karthik NayakAug 27, 2026
  15. Patrick SteinhardtAug 31, 2026
  16. 06/10 builtin/fsck: move packfile verification into the packed sourcePatrick Steinhardt, Aug 25, 2026
  17. 07/10 builtin/fsck: move reverse index verification into the packed sourcePatrick Steinhardt, Aug 25, 2026
  18. 08/10 builtin/fsck: move bitmap verification into the packed sourcePatrick Steinhardt, Aug 25, 2026
  19. Karthik NayakAug 27, 2026
  20. Patrick SteinhardtAug 31, 2026
  21. Karthik NayakAug 31, 2026
  22. 09/10 builtin/fsck: move multi-pack index verification into the packed sourcePatrick Steinhardt, Aug 25, 2026
  23. 10/10 builtin/fsck: move loose object verification into the loose sourcePatrick Steinhardt, Aug 25, 2026
  24. Karthik NayakAug 27, 2026
  25. 00/10 odb: make consistency checks pluggablePatrick Steinhardt, Aug 31, 2026
  26. 01/10 builtin/fsck: use `fsck_obj_buffer()` when checking loose objectsPatrick Steinhardt, Aug 31, 2026
  27. 02/10 builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()`Patrick Steinhardt, Aug 31, 2026
  28. 03/10 builtin/fsck: de-globalize option handlingPatrick Steinhardt, Aug 31, 2026
  29. 04/10 builtin/fsck: don't check alternates with "--no-full"Patrick Steinhardt, Aug 31, 2026
  30. 05/10 odb: provide infrastructure for pluggable fsck checksPatrick Steinhardt, Aug 31, 2026
  31. Toon ClaesSep 11, 2026
  32. Patrick SteinhardtSep 11, 2026
  33. 06/10 builtin/fsck: move packfile verification into the packed sourcePatrick Steinhardt, Aug 31, 2026
  34. 07/10 builtin/fsck: move reverse index verification into the packed sourcePatrick Steinhardt, Aug 31, 2026
  35. Toon ClaesSep 11, 2026
  36. 08/10 builtin/fsck: move bitmap verification into the packed sourcePatrick Steinhardt, Aug 31, 2026
  37. 09/10 builtin/fsck: move multi-pack index verification into the packed sourcePatrick Steinhardt, Aug 31, 2026
  38. Toon ClaesSep 11, 2026
  39. Patrick SteinhardtSep 11, 2026
  40. 10/10 builtin/fsck: move loose object verification into the loose sourcePatrick Steinhardt, Aug 31, 2026
  41. Toon ClaesSep 11, 2026
  42. Patrick SteinhardtSep 11, 2026
  43. Karthik NayakAug 31, 2026
  44. 00/10 odb: make consistency checks pluggablePatrick Steinhardt, Sep 11, 2026
  45. 01/10 builtin/fsck: use `fsck_obj_buffer()` when checking loose objectsPatrick Steinhardt, Sep 11, 2026
  46. 02/10 builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()`Patrick Steinhardt, Sep 11, 2026
  47. 03/10 builtin/fsck: de-globalize option handlingPatrick Steinhardt, Sep 11, 2026
  48. 04/10 builtin/fsck: don't check alternates with "--no-full"Patrick Steinhardt, Sep 11, 2026
  49. 05/10 odb: provide infrastructure for pluggable fsck checksPatrick Steinhardt, Sep 11, 2026
  50. 06/10 builtin/fsck: move packfile verification into the packed sourcePatrick Steinhardt, Sep 11, 2026
  51. 07/10 builtin/fsck: move reverse index verification into the packed sourcePatrick Steinhardt, Sep 11, 2026
  52. 08/10 builtin/fsck: move bitmap verification into the packed sourcePatrick Steinhardt, Sep 11, 2026
  53. 09/10 builtin/fsck: move multi-pack index verification into the packed sourcePatrick Steinhardt, Sep 11, 2026
  54. 10/10 builtin/fsck: move loose object verification into the loose sourcePatrick Steinhardt, Sep 11, 2026

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.