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

[PATCH 2/5] git-repack.sh: don't use --kept-pack-only option to pack-objects

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Mar 20, 2009, 03:47 UTC
Message-ID
<t_s5aa51o2kq_ePRWgLTEg6KbvKii55gDA1y-1oKgx9KP4EKyrqg8sDFaph97G5MPoLgUx_vx48@cipher.nrlssc.navy.mil>
In-Reply-To
<t_s5aa51o2kq_ePRWgLTEpak5ue1ZM7YICzIF-RsnmN68psiOC0Tnz9bsH5tTxgVEU0bxG-OtJ8@cipher.nrlssc.navy.mil>

The --kept-pack-only option to pack-objects treats all kept packs as equal. This results in objects that reside in an alternate pack that has a .keep file, not being packed into a newly created pack when the user specifies the -a option to repack. Since the user may not have any control over the alternate database, git should not refrain from repacking those objects even though they are in a pack with a .keep file.

This fixes the 'packed obs in alternate ODB kept pack are repacked' test in
t7700.
---
 git-repack.sh     |    6 +-----
 t/t7700-repack.sh |    2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/git-repack.sh b/git-repack.sh
index 0144c2d..1782a23 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -71,11 +71,7 @@ case ",$all_into_one," in
 				existing="$existing $e"
 			fi
 		done
-		if test -n "$existing"
-		then
-			args="--kept-pack-only"
-		fi
-		if test -n "$args" -a -n "$unpack_unreachable" -a \
+		if test -n "$existing" -a -n "$unpack_unreachable" -a \
 			-n "$remove_redundant"
 		then
 			args="$args $unpack_unreachable"
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index e869995..1242c9d 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -88,7 +88,7 @@ test_expect_failure 'packed obs in alt ODB are repacked when local repo has pack
 	done
 '
 
-test_expect_failure 'packed obs in alternate ODB kept pack are repacked' '
+test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
 	# swap the .keep so the commit object is in the pack with .keep
 	for p in alt_objects/pack/*.pack
 	do
-- 
1.6.2.16.geb16e
Previous: Brandon CaseyNext: Brandon Casey
Message 13 of 17 in “"git repack -a -d" improvements”
  1. 0/6 "git repack -a -d" improvementsJunio C Hamano, Feb 28, 2009
  2. 1/6 git-repack: resist stray environment variableJunio C Hamano, Feb 28, 2009
  3. 2/6 has_sha1_pack(): refactor "pretend these packs do not exist" interfaceJunio C Hamano, Feb 28, 2009
  4. 3/6 has_sha1_kept_pack(): take "struct rev_info"Junio C Hamano, Feb 28, 2009
  5. 4/6 Consolidate ignore_packed logic moreJunio C Hamano, Feb 28, 2009
  6. 5/6 Simplify is_kept_pack()Junio C Hamano, Feb 28, 2009
  7. 6/6 is_kept_pack(): final clean-upJunio C Hamano, Feb 28, 2009
  8. Kjetil BarvikFeb 28, 2009
  9. Junio C HamanoFeb 28, 2009
  10. Brandon CaseyMar 18, 2009
  11. 0/5 repack improvementsBrandon Casey, Mar 20, 2009
  12. 1/5 t7700-repack: add two new tests demonstrating repacking flawsBrandon Casey, Mar 20, 2009
  13. 2/5 git-repack.sh: don't use --kept-pack-only option to pack-objectsBrandon Casey, Mar 20, 2009
  14. 3/5 pack-objects: only repack or loosen objects residing in "local" packsBrandon Casey, Mar 20, 2009
  15. 4/5 t7700-repack: repack -a now works properly, expect success from testBrandon Casey, Mar 20, 2009
  16. 5/5 Remove --kept-pack-only option and associated infrastructureBrandon Casey, Mar 20, 2009
  17. Brandon CaseyMar 20, 2009

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.