git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Jeff King <peff@peff.net>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Daniel Barkalow <barkalow@iabervon.org>
Subject: [PATCH 3/4 v2] Prepare testsuite for a "git clone" that packs refs
Date: Mon, 16 Jun 2008 01:16:53 +0200	[thread overview]
Message-ID: <200806160116.53446.johan@herland.net> (raw)
In-Reply-To: <m3bq22poby.fsf@localhost.localdomain>

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@herland.net>
---

On Sunday 15 June 2008, Jakub Narebski wrote:
> Jeff King <peff@peff.net> 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

  reply	other threads:[~2008-06-15 23:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 14:02 [PATCH 0/4] Teach "git clone" to pack refs Johan Herland
2008-06-15 14:04 ` [PATCH 1/4] Incorporate fetched packs in future object traversal Johan Herland
2008-06-15 14:05 ` [PATCH 2/4] Move pack_refs() and friends into libgit Johan Herland
2008-06-15 17:52   ` Jeff King
2008-06-15 21:27     ` [PATCH 2/4 v2] " Johan Herland
2008-06-15 14:05 ` [PATCH 3/4] Prepare testsuite for a "git clone" that packs refs Johan Herland
2008-06-15 17:54   ` Jeff King
2008-06-15 18:04     ` Jakub Narebski
2008-06-15 23:16       ` Johan Herland [this message]
2008-06-15 14:06 ` [PATCH 4/4] Teach "git clone" to pack refs Johan Herland
2008-06-15 17:56   ` Jeff King
2008-06-15 22:03     ` Johan Herland
2008-06-16  9:57       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806160116.53446.johan@herland.net \
    --to=johan@herland.net \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).