aboutsummaryrefslogtreecommitdiffstats
path: root/test/create-repo.sh
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2015-01-05 19:30:52 +0000
committerAdam Spiers <git@adamspiers.org>2015-01-05 19:30:52 +0000
commitf1fa5efb0b0ad7ada8e8805c0c789b455369a8ba (patch)
treec4e3f603e3ba0b0c45b6a04ab39fa108cc32b051 /test/create-repo.sh
parentff82dda196947650bd497301e61b282753193564 (diff)
downloadgit-deps-f1fa5efb0b0ad7ada8e8805c0c789b455369a8ba.tar.gz
add script to generate fixture repository for testing
Diffstat (limited to 'test/create-repo.sh')
-rwxr-xr-xtest/create-repo.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/create-repo.sh b/test/create-repo.sh
new file mode 100755
index 0000000..589e1a2
--- /dev/null
+++ b/test/create-repo.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+here=$(dirname $0)
+
+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 three independently committed files
+
+cat <<EOF > one
+one
+two
+three
+four
+five
+six
+seven
+eight
+nine
+ten
+EOF
+
+git add one
+git commit -m 'one'
+git tag one
+
+for f in two three; do
+ cp one $f
+ git add $f
+ git commit -m "$f"
+ git tag "$f"
+done
+
+# Now start making changes
+
+sed -i 's/three/three a/' one
+git commit -am 'one: change three to three a'
+git tag one-three-a # depends on one
+
+sed -i 's/three/three a/' two
+git commit -am 'two: change three to three a'
+git tag two-three-a # depends on two
+
+# Change non-overlapping part of previously changed file
+sed -i 's/eight/eight a/' one
+git commit -am 'one: change eight to eight a'
+git tag one-eight-a # depends on one
+
+# Change previously changed line
+sed -i 's/three a/three b/' one
+git commit -am 'one: change three a to three b'
+git tag one-three-b # depends on one-three-a
+