chiark / gitweb /
Test suite: Replace open-coded $tmp/git/$p.git
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Jul 2015 23:35:28 +0000 (00:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Jul 2015 23:36:16 +0000 (00:36 +0100)
tests/lib
tests/tests/clone-gitnosuite
tests/tests/debpolicy-newreject
tests/tests/drs-push-masterupdate
tests/tests/tag-updates
tests/tests/trustingpolicy-replay

index ebfe5a788bdc3f41f45c31c36cba0c137b3a1c54..046d36289c1145b53d37f7b7d1dbd4d575e4d9b2 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -92,7 +92,7 @@ t-expect-push-fail () {
 t-git-objects-not-present () {
        # t-git-objects-not-present GITDIR|'' OBJID [...]
        # specifying '' means the repo for package $p
-       local gitdir="${1-$tmp/git/$p.git}"
+       local gitdir="${1-$dgitrepo}"
        local obj
        if ! [ -e "$gitdir" ]; then return; fi
        for obj in "$@"; do
@@ -107,8 +107,8 @@ t-reporefs () {
        local outputfile="$tmp/show-refs.$whichoutput"
        (set -e
         exec >"$outputfile"
-        if test -d $tmp/git/$p.git; then
-               cd $tmp/git/$p.git
+        if test -d $dgitrepo; then
+               cd $dgitrepo
                git show-ref |sort
        fi)
 }
@@ -130,6 +130,7 @@ t-worktree () {
 
 t-select-package () {
        p=$1
+       dgitrepo=$tmp/git/$p.git
 }
 
 t-git () {
@@ -251,11 +252,11 @@ t-archive () {
 }
 
 t-git-dir-time-passes () {
-       touch -d 'last year' $tmp/git/$p.git
+       touch -d 'last year' $dgitrepo
 }
 
 t-git-dir-check () {
-       local gitdir=$tmp/git/$p.git
+       local gitdir=$dgitrepo
        case "$1" in
        enoent)
                if test -e "$gitdir"; then fail "$gitdir exists"; fi
@@ -407,7 +408,7 @@ t-pushed-good () {
        t-refs-notexist \
                refs/heads/dgit/unstable \
                refs/remotes/dgit/dgit/unstable
-       (set -e; cd $tmp/git/$p.git
+       (set -e; cd $dgitrepo
         t-refs-same \
                refs/dgit/sid \
                `t-v-tag`
index 6eee25158803726f7dada21aea4bbf5b87708054..6b1c9375fa2461037840f353f172de8007caf3ae 100755 (executable)
@@ -4,6 +4,6 @@ set -e
 
 t-archive pari-extra 3-1
 t-git-none
-cp -a $tmp/git/_template $tmp/git/$p.git
+cp -a $tmp/git/_template $dgitrepo
 
 t-dgit clone $p
index 8bc0c8601a81eb42895cfaa1c6b5ed8908dc1f13..3f3114b2454790995f5577341327024468c38a95 100755 (executable)
@@ -82,7 +82,7 @@ t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
 
 t-dgit --deliberately-not-fast-forward push
 
-cd $tmp/git/$p.git
+cd $dgitrepo
 t-expect-push-fail "Not a valid object name" \
 git cat-file -p $oldobj
 cd $tmp/$p
index b5523e8234a33122b42b6e5bd1cd4118ea5934d7..9d2e6320705c30326fcae1ac79d2584a22239f8d 100755 (executable)
@@ -16,9 +16,9 @@ t-dgit build
 t-dgit push --new
 
 push_and_check () {
-       git push $tmp/git/$p.git $1
+       git push $dgitrepo $1
 
-       oldmaster=`cd $tmp/git/$p.git && t-git-get-ref refs/heads/master`
+       oldmaster=`cd $dgitrepo && t-git-get-ref refs/heads/master`
 
        t-refs-same-start
        git checkout master
@@ -38,7 +38,7 @@ t_check_pushed_master=t-check-master-undisturbed
 
 git checkout -b divergent common-ancestor
 git commit --allow-empty -m 'Has common ancestor'
-git push $tmp/git/$p.git HEAD:master
+git push $dgitrepo HEAD:master
 
 push_and_check HEAD:master
 
index 544be162496495b23efd9fb1d79003af6cd6eb73..1ef7dcdc2eceddc8acb93a432ce61702393ccd9a 100755 (executable)
@@ -14,7 +14,7 @@ tagref=`t-v-tag`
 tagname=${tn#refs/tags}
 
 (set -e
- cd $tmp/git/$p.git
+ cd $dgitrepo
  git tag -m UNWANTED unwanted dgit/sid)
 
 fetch-check () {
index f2a704317e34154ac2e0e525dfb66af4a8e76d52..b779f64b129b1c604559f42c92133586693652b3 100755 (executable)
@@ -67,7 +67,7 @@ attempt-replay () {
 prepare-replay --deliberately-fresh-repo
 
 # simulate some other thing that we shouldn't delete
-git push $tmp/git/$p.git +master:refs/heads/for-testing
+git push $dgitrepo +master:refs/heads/for-testing
 
 attempt-replay 'does not declare previously heads/for-testing'