summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-26 21:50:09 +0000
committerMichał Górny <mgorny@gentoo.org>2013-09-26 21:50:09 +0000
commita0fc2ae678ae7e1fe4bc0b88a221f30629d51a41 (patch)
tree04ea7d29928bd60f1fb5c60962152b89126f033d /eclass/tests
parentVersion bump. Fixes requiring tinynotify-send aside sw-notify-send, bug #485898. (diff)
downloadgentoo-2-a0fc2ae678ae7e1fe4bc0b88a221f30629d51a41.tar.gz
gentoo-2-a0fc2ae678ae7e1fe4bc0b88a221f30629d51a41.tar.bz2
gentoo-2-a0fc2ae678ae7e1fe4bc0b88a221f30629d51a41.zip
Switch the tests to reuse the same git repo.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/git-r3.sh158
1 files changed, 66 insertions, 92 deletions
diff --git a/eclass/tests/git-r3.sh b/eclass/tests/git-r3.sh
index 7d4ce7e049e9..794f34140941 100755
--- a/eclass/tests/git-r3.sh
+++ b/eclass/tests/git-r3.sh
@@ -41,178 +41,152 @@ test_no_file() {
}
test_repo_clean() {
- local repo=${FUNCNAME#test_}
- local P=${P}_${repo}
+ local P=${P}_${FUNCNAME#test_}
(
- mkdir ${repo}
- cd ${repo}
+ mkdir repo
+ cd repo
git init -q
echo test > file
git add file
git commit -m 1 -q
- echo other-text > file
- git add file
+ echo other-text > file2
+ git add file2
git commit -m 2 -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/${repo}"
+ "ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
tbegin "fetching from a simple repo"
(
git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" other-text
+ test_file "${WORKDIR}/${P}/file" test && \
+ test_file "${WORKDIR}/${P}/file2" other-text
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_revert() {
- local repo=${FUNCNAME#test_}
- local P=${P}_${repo}
+ local P=${P}_${FUNCNAME#test_}
(
- mkdir ${repo}
- cd ${repo}
- git init -q
- echo test > file
- git add file
- git commit -m 1 -q
- echo other-text > file2
- git add file2
- git commit -m 2 -q
+ cd repo
git revert -n HEAD^
- git commit -m 3 -q
+ git commit -m r1 -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/${repo}"
+ "ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
- tbegin "fetching from a repo with reverted commit"
+ tbegin "fetching revert"
(
git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file2" other-text \
- && test_no_file "${WORKDIR}/${P}/file"
+ test_no_file "${WORKDIR}/${P}/file" && \
+ test_file "${WORKDIR}/${P}/file2" other-text
) &>fetch.log
eend ${?} || cat fetch.log
}
-test_repo_merge() {
- local repo=${FUNCNAME#test_}
- local P=${P}_${repo}
+test_repo_branch() {
+ local P=${P}_${FUNCNAME#test_}
(
- mkdir ${repo}
- cd ${repo}
- git init -q
- echo test > file
- git add file
- git commit -m 1 -q
- git checkout -q -b other
- echo other-text > file2
- git add file2
- git commit -m 2 -q
- git checkout -q master
- echo some-more-text > file
- git add file
+ cd repo
+ git branch -q other-branch HEAD^
+ git checkout -q other-branch
+ echo one-more > file3
+ git add file3
git commit -m 3 -q
- git merge -m 4 -q other
+ git checkout -q master
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/${repo}"
+ "ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
+ local EGIT_BRANCH=other-branch
- tbegin "fetching from a repository with a merge commit"
+ tbegin "switching branches"
(
git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" some-more-text \
- && test_file "${WORKDIR}/${P}/file2" other-text
+ test_file "${WORKDIR}/${P}/file" test && \
+ test_file "${WORKDIR}/${P}/file2" other-text && \
+ test_file "${WORKDIR}/${P}/file3" one-more
) &>fetch.log
eend ${?} || cat fetch.log
}
-test_repo_merge_revert() {
- local repo=${FUNCNAME#test_}
- local P=${P}_${repo}
+test_repo_merge() {
+ local P=${P}_${FUNCNAME#test_}
(
- mkdir ${repo}
- cd ${repo}
- git init -q
- echo test > file
- git add file
- git commit -m 1 -q
- git checkout -q -b other
- echo other-text > file2
- git add file2
- git commit -m 2 -q
+ cd repo
+ git branch -q one-more-branch HEAD^
+ git checkout -q one-more-branch
+ echo foobarbaz > file3
+ git add file3
+ git commit -m 3b -q
git checkout -q master
- echo some-more-text > file
- git add file
- git commit -m 3 -q
- git merge -m 4 -q other
- git revert -n -m 1 HEAD
- git commit -m 5 -q
+ git merge -m 4 -q one-more-branch
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/${repo}"
+ "ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
- tbegin "fetching from a repository with a reverted merge commit"
+ tbegin "fetching a merge commit"
(
git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" some-more-text \
- && test_no_file "${WORKDIR}/${P}/file2"
+ test_no_file "${WORKDIR}/${P}/file" && \
+ test_file "${WORKDIR}/${P}/file2" other-text && \
+ test_file "${WORKDIR}/${P}/file3" foobarbaz
) &>fetch.log
eend ${?} || cat fetch.log
}
-test_repo_merge_revert2() {
- local repo=${FUNCNAME#test_}
- local P=${P}_${repo}
+test_repo_revert_merge() {
+ local P=${P}_${FUNCNAME#test_}
(
- mkdir ${repo}
- cd ${repo}
- git init -q
- echo test > file
- git add file
- git commit -m 1 -q
- git checkout -q -b other
- echo other-text > file2
- git add file2
- git commit -m 2 -q
+ cd repo
+ git branch -q to-be-reverted
+ git checkout -q to-be-reverted
+ echo trrm > file3
+ git add file3
+ git commit -m 5b -q
git checkout -q master
- echo some-more-text > file
- git add file
- git commit -m 3 -q
- git merge -m 4 -q other
- git revert -n -m 2 HEAD
+ echo trrm > file2
+ git add file2
git commit -m 5 -q
+ git merge -m 6 -q to-be-reverted
+ echo trrm > file
+ git add file
+ git commit -m 7 -q
+ git revert -m 1 -n HEAD^
+ git commit -m 7r -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/${repo}"
+ "ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
- tbegin "fetching from a repository with a reverted merge commit (other way)"
+ tbegin "fetching a revert of a merge commit"
(
git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" test \
- && test_file "${WORKDIR}/${P}/file2" other-text
+ test_file "${WORKDIR}/${P}/file" trrm && \
+ test_file "${WORKDIR}/${P}/file2" trrm && \
+ test_file "${WORKDIR}/${P}/file3" foobarbaz
) &>fetch.log
eend ${?} || cat fetch.log
@@ -220,8 +194,8 @@ test_repo_merge_revert2() {
test_repo_clean
test_repo_revert
+test_repo_branch
test_repo_merge
-test_repo_merge_revert
-test_repo_merge_revert2
+test_repo_revert_merge
texit