summaryrefslogtreecommitdiff
path: root/t/t5800-remote-helpers.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-07-16 13:03:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-07-19 18:17:46 (GMT)
commit5cf5ade371d60f97fef2eb7ef37780ed86fa4963 (patch)
tree4d9cacbb6acd5af429cf4bb21df0fd11a7049e6a /t/t5800-remote-helpers.sh
parent2faa15274d7bf474d3c382ce36a3e4b7b21bdaa4 (diff)
downloadgit-5cf5ade371d60f97fef2eb7ef37780ed86fa4963.zip
git-5cf5ade371d60f97fef2eb7ef37780ed86fa4963.tar.gz
git-5cf5ade371d60f97fef2eb7ef37780ed86fa4963.tar.bz2
t5800: factor out some ref tests
These are a little hard to read, and I'm about to add more just like them. Plus the failure output is nicer if we use test_cmp than a comparison with "test". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5800-remote-helpers.sh')
-rwxr-xr-xt/t5800-remote-helpers.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/t/t5800-remote-helpers.sh b/t/t5800-remote-helpers.sh
index 1fb6380..3a37ad0 100755
--- a/t/t5800-remote-helpers.sh
+++ b/t/t5800-remote-helpers.sh
@@ -17,6 +17,12 @@ then
test_set_prereq PYTHON_24
fi
+compare_refs() {
+ git --git-dir="$1/.git" rev-parse --verify $2 >expect &&
+ git --git-dir="$3/.git" rev-parse --verify $4 >actual &&
+ test_cmp expect actual
+}
+
test_expect_success PYTHON_24 'setup repository' '
git init --bare server/.git &&
git clone server public &&
@@ -59,8 +65,7 @@ test_expect_success PYTHON_24 'pushing to local repo' '
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)
+ compare_refs localclone HEAD server HEAD
'
test_expect_success PYTHON_24 'synch with changes from localclone' '
@@ -73,8 +78,7 @@ test_expect_success PYTHON_24 'pushing remote local repo' '
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)
+ compare_refs clone HEAD server HEAD
'
test_done