git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: git@vger.kernel.org
Cc: jrnieder@gmail.com, gitster@pobox.com, bebarino@gmail.com,
	Chris Packham <judge.packham@gmail.com>
Subject: [PATCHv2 2/2] tests for git alternate command
Date: Wed, 24 Mar 2010 23:07:31 -0700	[thread overview]
Message-ID: <1269497251-13103-3-git-send-email-judge.packham@gmail.com> (raw)
In-Reply-To: <a038bef51003241335l1623ade4i4a9b7269546739d4@mail.gmail.com>

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
I wasn't sure about the test numbering so I just grabbed the highest one. Still
need to add tests for the deletion use case.

 t/t9800-git-alternate.sh |   95 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 t/t9800-git-alternate.sh

diff --git a/t/t9800-git-alternate.sh b/t/t9800-git-alternate.sh
new file mode 100644
index 0000000..e95f5bd
--- /dev/null
+++ b/t/t9800-git-alternate.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+test_description='Test of git alternate command'
+
+. ./test-lib.sh
+
+test_expect_success \
+	'Setup for rest of the test' '
+	mkdir -p base &&
+	cd base &&
+	git init &&
+	echo test > a.txt &&
+	echo test > b.txt &&
+	echo test > c.txt &&
+	git add *.txt &&
+	git commit -a -m "Initial Commit" &&
+	cd .. &&
+	git clone base A &&
+	git clone A B &&
+	git clone A C &&
+	git clone A D
+'
+
+test_expect_success \
+	'Add alternate after clone' '
+	(cd B &&
+	git alternate -a ../base/.git/objects
+	)
+'
+
+test_expect_success \
+	'add same alternate fails adding existing abs path' '
+	(cd B &&
+	test_must_fail git alternate -a $PWD/base/.git/objects
+	)
+'
+
+test_expect_success \
+ 	'add same alternate fails adding existing relative path' '
+ 	(cd B &&
+ 	test_must_fail git alternate -a ../base/.git/objects
+ 	)
+'
+
+test_expect_success \
+	'Add multiple alternates' '
+	(cd C &&
+	git alternate -a ../base/.git/objects &&
+	git alternate -a ../B/.git/objects
+	)
+'
+
+test_expect_success \
+	'Add recursive alternate' '
+	(cd D &&
+	git alternate -a ../C/.git/objects
+	)
+'
+
+test_expect_success \
+	'test git alternate display' '
+	testbase=$PWD
+	(cd B &&
+	git alternate >actual &&
+	{
+		echo "Object store $testbase/base/.git/objects"
+		echo "    referenced via $testbase/B/.git"
+	} >expect &&
+	test_cmp expect actual
+	)
+'
+
+test_expect_success \
+	'test git alternate recursive display' '
+	testbase=$PWD
+	(cd D &&
+
+	git alternate -r >actual &&
+
+	{
+		echo "Object store $testbase/C/.git/objects"
+		echo "    referenced via $testbase/D/.git"
+		echo "Object store $testbase/base/.git/objects"
+		echo "    referenced via $testbase/C/.git"
+		echo "Object store $testbase/B/.git/objects"
+		echo "    referenced via $testbase/C/.git"
+		echo "Object store $testbase/base/.git/objects"
+		echo "    referenced via $testbase/B/.git"
+	} >expect &&
+
+	test_cmp expect actual
+	)
+'
+
+#rm -rf A B C D base
\ No newline at end of file
-- 
1.7.0.3

  parent reply	other threads:[~2010-03-25  6:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 17:26 Question about .git/objects/info/alternates Chris Packham
2010-03-23  2:42 ` Jonathan Nieder
2010-03-24 18:53   ` Chris Packham
2010-03-24 19:23     ` Jonathan Nieder
2010-03-24 19:58     ` Junio C Hamano
2010-03-24 20:35       ` Chris Packham
2010-03-25  6:07         ` Chris Packham
2010-03-25  6:07         ` [PATCHv2 1/2] Add git alternate command Chris Packham
2010-03-29  7:32           ` Junio C Hamano
2010-03-31  4:35             ` Chris Packham
2010-03-25  6:07         ` Chris Packham [this message]
2010-03-25  7:38           ` [PATCHv2 2/2] tests for " Johannes Sixt
2010-03-25 18:51             ` Chris Packham
2010-03-26  0:48               ` Miklos Vajna
2010-03-26  6:44               ` Johannes Sixt
2010-03-24 20:16     ` Question about .git/objects/info/alternates Stephen Boyd
2010-03-24 20:37       ` Chris Packham

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=1269497251-13103-3-git-send-email-judge.packham@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /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).