Skip to content

fsck: verify .bitmap checksums, cleanup

Derrick Stolee via GitGitGadget git 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fsck: verify checksums of all .bitmap filesbuiltin/fsck.c pack-bitmap.c pack-bitmap.h +1 more+95 -00 replies
2/2fsck: use local repositorybuiltin/fsck.c+3 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] fsck: verify .bitmap checksums, cleanup

Similar to the recent work on rev-indexes [1], add checks for .bitmap files to 'git fsck'.

Patch 1 includes the full details for .bitmap files.

Patch 2 includes a cleanup of ds/fsck-pack-revindex that I noticed while preparing this series.

Updates since v2
================

* The code for verify_bitmap_file() added checks for a negative file descriptor, as well as some other cleanup.
* The test in t5326 is expanded to include the "both are corrupt" case, as well as a reorganization because the test was not confined to an inner repo.

Thanks, Stolee

[1]
https://lore.kernel.org/git/[email protected]/

Derrick Stolee (2):
fsck: verify checksums of all .bitmap files
fsck: use local repository

 builtin/fsck.c                | 10 +++++---
 pack-bitmap.c                 | 45 +++++++++++++++++++++++++++++++++++
 pack-bitmap.h                 |  2 ++
 t/t5326-multi-pack-bitmaps.sh | 44 ++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+), 3 deletions(-)

base-commit: 48d89b51b3bb8a60580c36731b96a7206ce1e5b9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1526%2Fderrickstolee%2Ffsck-bitmap-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1526/derrickstolee/fsck-bitmap-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1526

Range-diff vs v1:

1: d608d2faa86 ! 1: 5d6d6658633 fsck: verify checksums of all .bitmap files

     @@ pack-bitmap.c: int bitmap_is_preferred_refname(struct repository *r, const char
      +	int fd = git_open(name);
      +	int res = 0;
      +
     -+	/* A non-existent file is valid. */
     -+	if (fstat(fd, &st)) {
     -+		close(fd);
     ++	/* It is OK to not have the file. */
     ++	if (fd < 0 || fstat(fd, &st)) {
     ++		if (fd >= 0)
     ++			close(fd);
      +		return 0;
      +	}
      +
     @@ t/t5326-multi-pack-bitmaps.sh: test_expect_success 'tagged commits are selected
      +	cp "$packbitmap.bak" "$packbitmap" &&
      +
      +	# fsck works at first
     -+	git fsck &&
     ++	git fsck 2>err &&
     ++	test_must_be_empty err &&
      +
      +	corrupt_file "$packbitmap" &&
      +	test_must_fail git fsck 2>err &&
     @@ t/t5326-multi-pack-bitmaps.sh: test_expect_success 'tagged commits are selected
      +	cp "$packbitmap.bak" "$packbitmap" &&
      +	corrupt_file "$midxbitmap" &&
      +	test_must_fail git fsck 2>err &&
     -+	grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err
     ++	grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
     ++
     ++	corrupt_file "$packbitmap" &&
     ++	test_must_fail git fsck 2>err &&
     ++	grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
     ++	grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err
      +'
      +
       test_done

2: 2162a352a46 = 2: 00789bbc558 fsck: use local repository

Signature · 1 line
gitgitgadget