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

[PATCH 3/4] Prepare testsuite for a "git clone" that packs refs

From
Johan Herland <johan@herland.net>
Date
Apr 14, 2008, 08:03 UTC
Message-ID
<200804141003.39170.johan@herland.net>
In-Reply-To
<200804141000.09515.johan@herland.net>

t5515-fetch-merge-logic removes many, but not all, refs between each test. This is done by removing the corresponding refs/foo/* files in the .git/refs hierarchy. However, once "git clone" starts producing packed refs, these refs will no longer be in the .git/refs hierarchy, but rather listed in .git/packed-refs. This patch therefore teaches t5515-fetch-merge-logic to also remove the refs in question from the packed-refs file.

Signed-off-by: Johan Herland <johan@herland.net>
---
 t/t5515-fetch-merge-logic.sh |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 65c3774..8a8c35c 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -145,6 +145,25 @@ do
 			rm -f .git/refs/heads/*
 			rm -f .git/refs/remotes/rem/*
 			rm -f .git/refs/tags/*
+			cat .git/packed-refs | \
+			while read sha1 refname
+			do
+				case "$sha1" in
+				^*) # remove peeled tags
+					;;
+				*)
+					case "$refname" in
+					refs/heads/*|\
+					refs/remotes/rem/*|\
+					refs/tags/*) # remove same as above
+						;;
+					*) # keep everything else
+						echo "$sha1 $refname"
+						;;
+					esac
+				esac
+			done > .git/packed-refs.new
+			mv .git/packed-refs.new .git/packed-refs
 			git fetch "$@" >/dev/null
 			cat .git/FETCH_HEAD
 		} >"$actual_f" &&
-- 
1.5.5.159.g8c84b
Previous: Johan HerlandNext: Johan Herland
Message 8 of 13 in “Teach builtin-clone to pack refs”
  1. 0/3 Teach builtin-clone to pack refsJohan Herland, Mar 22, 2008
  2. 1/3 Move pack_refs() and friends into libgitJohan Herland, Mar 22, 2008
  3. 2/3 Prepare testsuite for a "git clone" that packs refsJohan Herland, Mar 22, 2008
  4. Daniel BarkalowApr 14, 2008
  5. Johan HerlandApr 14, 2008
  6. 1/4 Incorporate fetched packs in future object traversalJohan Herland, Apr 14, 2008
  7. 2/4 Move pack_refs() and friends into libgitJohan Herland, Apr 14, 2008
  8. 3/4 Prepare testsuite for a "git clone" that packs refsJohan Herland, Apr 14, 2008
  9. 4/4 Teach "git clone" to pack refsJohan Herland, Apr 14, 2008
  10. 3/3 Teach "git clone" to pack refsJohan Herland, Mar 22, 2008
  11. Daniel BarkalowMar 22, 2008
  12. Junio C HamanoMar 23, 2008
  13. Johan HerlandMar 23, 2008

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.