aboutsummaryrefslogtreecommitdiffstats
path: root/tests/create-repo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/create-repo.sh')
-rwxr-xr-xtests/create-repo.sh79
1 files changed, 42 insertions, 37 deletions
diff --git a/tests/create-repo.sh b/tests/create-repo.sh
index bfaffe2..029161c 100755
--- a/tests/create-repo.sh
+++ b/tests/create-repo.sh
@@ -1,26 +1,10 @@
#!/bin/bash
here=$(dirname $0)
-
-tag () {
- git tag "$@"
- echo -n "Hit Enter to continue ..."
- read
-}
-
test_repo=$here/test-repo
-rm -rf $test_repo
-mkdir $test_repo
-cd $test_repo
-
-git init
-git config user.email git-deps-test@fake.address
-
-# Start with two independently committed files
-
-for f in file-{a,b}; do
- cat <<EOF > $f
+new_file () {
+ cat <<EOF > $1
one
two
three
@@ -33,28 +17,49 @@ nine
ten
EOF
- git add $f
- git commit -m "create $f"
- tag $f
-done
+ git add $1
+ git commit -m "create $1"
+ tag $1
+}
-# Now start making changes
+tag () {
+ git tag "$@"
+ echo -n "Hit Enter to continue ..."
+ read
+}
-sed -i 's/three/three a/' file-a
-git commit -am 'file-a: change three to three a'
-tag file-a-three-a # depends on file-a
+main () {
+ rm -rf $test_repo
+ mkdir $test_repo
+ cd $test_repo
-sed -i 's/three/three a/' file-b
-git commit -am 'file-b: change three to three a'
-tag file-b-three-a # depends on file-b
+ git init
+ git config user.email git-deps-test@fake.address
-# Change non-overlapping part of previously changed file
-sed -i 's/eight/eight a/' file-a
-git commit -am 'file-a: change eight to eight a'
-tag file-a-eight-a # depends on file-a
+ # Start with two independently committed files
+ for f in file-{a,b}; do
+ new_file $f
+ done
-# Change previously changed line
-sed -i 's/three a/three b/' file-a
-git commit -am 'file-a: change three a to three b'
-tag file-a-three-b # depends on file-a-three-a
+ # Now start making changes
+
+ sed -i 's/three/three a/' file-a
+ git commit -am 'file-a: change three to three a'
+ tag file-a-three-a # depends on file-a
+
+ sed -i 's/three/three a/' file-b
+ git commit -am 'file-b: change three to three a'
+ tag file-b-three-a # depends on file-b
+
+ # Change non-overlapping part of previously changed file
+ sed -i 's/eight/eight a/' file-a
+ git commit -am 'file-a: change eight to eight a'
+ tag file-a-eight-a # depends on file-a
+
+ # Change previously changed line
+ sed -i 's/three a/three b/' file-a
+ git commit -am 'file-a: change three a to three b'
+ tag file-a-three-b # depends on file-a-three-a
+}
+main