Subject: [PATCH v2 0/4] Reactions to v2.37.0-rc0 test coverage report

From: "Derrick Stolee via GitGitGadget" <[email-masked]>
Date: Thu, 16 Jun 2022 13:13:46 +0000

These patches add test coverage or simplify code based on discoveries in the
test coverage report (specifically, some that I highlighted at [1]).

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

 1. Add tests for 'git update-index --verbose'.
 2. Add 'git gc --cruft' without '--prune=now' to test.
 3. Drop an always-NULL parameter from an internal method.
 4. Revert 080ab56a4 (cache-tree: implement cache_tree_find_path(),
    2022-05-23).

Any subset of these could be taken (or dropped), but I thought they would be
worth considering.

Updates in v2
=============

 * A useless addition of --verbose was removed from a test in patch 1.
 * Comments are updated in patch 2 based on Taylor's recommendations.
 * Added --prune="01-01-1980" to exercise the --cruft-expiration logic
   underneath 'git gc --cruft'.

Thanks, -Stolee

Derrick Stolee (4):
  t2107: test 'git update-index --verbose'
  t5329: test 'git gc --cruft' without '--prune=now'
  pack-write: drop always-NULL parameter
  cache-tree: remove cache_tree_find_path()

 cache-tree.c                  | 27 ---------------------------
 cache-tree.h                  |  2 --
 pack-write.c                  | 17 ++++++-----------
 t/t2107-update-index-basic.sh | 31 +++++++++++++++++++++++++------
 t/t5329-pack-objects-cruft.sh |  4 +++-
 5 files changed, 34 insertions(+), 47 deletions(-)

base-commit: 8168d5e9c23ed44ae3d604f392320d66556453c9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1261%2Fderrickstolee%2Ftest-coverage-response-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1261/derrickstolee/test-coverage-response-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1261

Range-diff vs v1:

 1:  c6803df1b6a ! 1:  c22963b49e6 t2107: test 'git update-index --verbose'
     @@ Commit message
      
          Signed-off-by: Derrick Stolee <[email-masked]>
      
     - ## t/t2106-update-index-assume-unchanged.sh ##
     -@@ t/t2106-update-index-assume-unchanged.sh: test_expect_success 'do not switch branches with dirty file' '
     - 	git reset --hard &&
     - 	git checkout other &&
     - 	echo dirt >file &&
     --	git update-index --assume-unchanged file &&
     -+	git update-index --verbose --assume-unchanged file &&
     - 	test_must_fail git checkout - 2>err &&
     - 	test_i18ngrep overwritten err
     - '
     -
       ## t/t2107-update-index-basic.sh ##
      @@ t/t2107-update-index-basic.sh: test_expect_success '--cacheinfo does not accept blob null sha1' '
       	echo content >file &&
 2:  f59a0c326a0 ! 2:  ca5dbc29e40 t5329: test 'git gc --cruft' without '--prune=now'
     @@ t/t5329-pack-objects-cruft.sh: test_expect_success 'expiring cruft objects with
       		comm -13 reachable objects >unreachable &&
       
      -		git repack --cruft -d &&
     -+		# Write a cruft pack instead of deleting files.
     -+		git gc --cruft &&
     ++		# Write a cruft pack containing all unreachable objects.
     ++		git gc --cruft --prune="01-01-1980" &&
       
       		mtimes=$(ls .git/objects/pack/pack-*.mtimes) &&
       		test_path_is_file $mtimes &&
       
     -+		# Ignore the cruft pack and delete every unreachable object.
     ++		# Prune all unreachable objects from the cruft pack.
       		git gc --cruft --prune=now &&
       
       		git cat-file --batch-all-objects --batch-check="%(objectname)" >objects &&
 3:  b67e110bf60 = 3:  b956a371c70 pack-write: drop always-NULL parameter
 4:  81d8e2b5fdd = 4:  8486a1d6eca cache-tree: remove cache_tree_find_path()

-- 
gitgitgadget