git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sverre Rabbelier <srabbelier@gmail.com>
To: "Git List" <git@vger.kernel.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Daniel Barkalow" <barkalow@iabervon.org>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Jonathan Niede
Cc: Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH 7/7] remote-helpers: add tests for testgit helper
Date: Mon, 29 Mar 2010 11:48:29 -0500	[thread overview]
Message-ID: <1269881309-19690-8-git-send-email-srabbelier@gmail.com> (raw)
In-Reply-To: <1269881309-19690-1-git-send-email-srabbelier@gmail.com>

---

	I used a httpd server for the remote at first, but figured
	we should probably not depend on those tests being run. It
	was fairly trivial to make the testgit helper treat file://
	urls as 'remote', so I figured that'd work just as well.

 t/t5800-remote-helpers.sh |   70 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100755 t/t5800-remote-helpers.sh

diff --git a/t/t5800-remote-helpers.sh b/t/t5800-remote-helpers.sh
new file mode 100755
index 0000000..33f546b
--- /dev/null
+++ b/t/t5800-remote-helpers.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Sverre Rabbelier
+#
+
+test_description='Test remote-helper import and export commands'
+
+. ./test-lib.sh
+
+test_expect_success 'setup repository' '
+	git init --bare server/.git &&
+	git clone server public
+	(cd public &&
+	 echo content >file &&
+	 git add file &&
+	 git commit -m one &&
+	 git push origin master)
+'
+
+test_expect_success 'cloning from local repo' '
+	git clone "testgit::${PWD}/server" localclone
+	test_cmp public/file localclone/file
+'
+
+test_expect_success 'cloning from remote repo' '
+	git clone "testgit::file://${PWD}/server" clone &&
+	test_cmp public/file clone/file
+'
+
+test_expect_success 'create new commit on remote' '
+	(cd public &&
+	 echo content >>file &&
+	 git commit -a -m two &&
+	 git push)
+'
+
+test_expect_success 'pulling from local repo' '
+	(cd localclone && git pull) &&
+	test_cmp public/file localclone/file
+'
+
+test_expect_success 'pulling from remote remote' '
+	(cd clone && git pull) &&
+	test_cmp public/file clone/file
+'
+
+test_expect_success 'pushing to local repo' '
+	(cd localclone &&
+	echo content >>file &&
+	git commit -a -m three &&
+	git push) &&
+	HEAD=$(git --git-dir=localclone/.git rev-parse --verify HEAD) &&
+	test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
+'
+
+test_expect_success 'synch with changes from localclone' '
+	(cd clone &&
+	 git pull)
+'
+
+test_expect_success 'pushing remote local repo' '
+	(cd clone &&
+	echo content >>file &&
+	git commit -a -m four &&
+	git push) &&
+	HEAD=$(git --git-dir=clone/.git rev-parse --verify HEAD) &&
+	test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
+'
+
+test_done
-- 
1.7.0.3.317.gbb04ec

  parent reply	other threads:[~2010-03-29 16:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 16:48 [PATCH 0/7] remote-helpers: exporting Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 1/7] clone: pass the remote name to remote_get Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 2/7] clone: also configure url for bare clones Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 3/7] fast-import: always create marks_file directories Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 4/7] remote-helpers: allow requesing the path to the .git directory Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 5/7] remote-helpers: add support for an export command Sverre Rabbelier
2010-03-29 17:21   ` Daniel Barkalow
2010-03-29 17:28     ` Sverre Rabbelier
2010-04-01  4:54   ` Junio C Hamano
2010-04-01 15:14     ` Sverre Rabbelier
2010-03-29 16:48 ` [PATCH 6/7] remote-helpers: add testgit helper Sverre Rabbelier
2010-03-29 16:48 ` Sverre Rabbelier [this message]
2010-04-12 14:24   ` [PATCH 7/7] remote-helpers: add tests for " Jonathan Nieder
2010-04-12 14:26     ` Sverre Rabbelier

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=1269881309-19690-8-git-send-email-srabbelier@gmail.com \
    --to=srabbelier@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).