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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 teaches t5515-fetch-merge-logic to remove the
refs using "git update-ref -d" which properly handles packed refs.

Signed-off-by: Johan Herland <johan@xxxxxxxxxxx>
---

On Sunday 15 June 2008, Jakub Narebski wrote:
> Jeff King <peff@xxxxxxxx> writes:
> > Might it not be simpler to just convert it to use plumbing to delete
> > the refs? Something like piping for-each-ref into update-ref -d?
>
> Or use git-for-each-ref with --shell option to generate code for
> deleting refs?

Thanks for the tip. The following seems to do the job, and looks much better.


Have fun! :)

...Johan

 t/t5515-fetch-merge-logic.sh |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 3def75e..9de8408 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -142,9 +142,12 @@ do
 			set x $cmd; shift
 			git symbolic-ref HEAD refs/heads/$1 ; shift
 			rm -f .git/FETCH_HEAD
-			rm -f .git/refs/heads/*
-			rm -f .git/refs/remotes/rem/*
-			rm -f .git/refs/tags/*
+			git for-each-ref --format="%(refname)" \
+				refs/heads refs/remotes/rem refs/tags | \
+			while read refname
+			do
+				git update-ref -d "$refname"
+			done
 			git fetch "$@" >/dev/null
 			cat .git/FETCH_HEAD
 		} >"$actual_f" &&
-- 
1.5.6.rc2.128.gf64ae

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux