summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-12 15:54:59 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-12 15:54:59 +1000
commit98c22a36fdaf8806f8fafe8f1e23e53f8e97658d (patch)
tree4e04dfe9889df3e06ebb43daa2810e557c552821
parent7bfd8155c2482afd3c09ac7991e8f8f7f0d0338b (diff)
rearrange test repo generators
-rw-r--r--.gitignore1
-rwxr-xr-xtest/case_insensitive_checkouts.sh30
-rwxr-xr-xtest/lots_of_commits.sh30
-rwxr-xr-xtest/repos/case_insensitive_checkouts.sh16
-rw-r--r--test/repos/extras/pre-commit7
-rwxr-xr-xtest/repos/lots_of_commits.sh16
-rwxr-xr-xtest/repos/merge_conflict.sh (renamed from test/merge_conflict.sh)17
-rwxr-xr-xtest/repos/pre_commit_hook.sh9
-rwxr-xr-xtest/repos/unicode_characters.sh (renamed from test/unicode_characters.sh)17
9 files changed, 51 insertions, 92 deletions
diff --git a/.gitignore b/.gitignore
index 4a37f6ec0..f516cbbaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ notes/go.notes
TODO.notes
TODO.md
test/testrepo/
+test/repos/*/repo \ No newline at end of file
diff --git a/test/case_insensitive_checkouts.sh b/test/case_insensitive_checkouts.sh
deleted file mode 100755
index d797a4181..000000000
--- a/test/case_insensitive_checkouts.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# this script makes a repo with lots of commits
-
-# call this command from the test directory:
-# ./lots_of_commits.sh; cd testrepo; gg; cd ..
-
-# -e means exit if something fails
-# -x means print out simple commands before running them
-set -ex
-
-reponame="case_insensitive_checkouts"
-
-rm -rf ${reponame}
-mkdir ${reponame}
-cd ${reponame}
-
-git init
-
-touch foo
-git add foo
-git commit -m "init"
-git branch -a
-git branch test
-git branch TEST
-git checkout TEST
-git checkout TeST
-git checkout TesT
-git checkout TEsT
-git branch -a \ No newline at end of file
diff --git a/test/lots_of_commits.sh b/test/lots_of_commits.sh
deleted file mode 100755
index b56c9a6be..000000000
--- a/test/lots_of_commits.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# this script makes a repo with lots of commits
-
-# call this command from the test directory:
-# ./lots_of_commits.sh; cd testrepo; gg; cd ..
-
-# -e means exit if something fails
-# -x means print out simple commands before running them
-set -ex
-
-reponame="lots_of_commits"
-
-rm -rf ${reponame}
-mkdir ${reponame}
-cd ${reponame}
-
-git init
-
-i=2
-end=100
-while [ $i -le $end ]; do
- echo "file${i}" > file${i}
- git add file${i}
- git commit -m file${i}
-
- i=$(($i+1))
-done
-
-echo "unstaged change" > file100
diff --git a/test/repos/case_insensitive_checkouts.sh b/test/repos/case_insensitive_checkouts.sh
new file mode 100755
index 000000000..23997a670
--- /dev/null
+++ b/test/repos/case_insensitive_checkouts.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -ex; rm -rf repo; mkdir repo; cd repo
+
+git init
+
+touch foo
+git add foo
+git commit -m "init"
+git branch -a
+git branch test
+git branch TEST
+git checkout TEST
+git checkout TeST
+git checkout TesT
+git checkout TEsT
+git branch -a \ No newline at end of file
diff --git a/test/repos/extras/pre-commit b/test/repos/extras/pre-commit
new file mode 100644
index 000000000..3f7e7a5bb
--- /dev/null
+++ b/test/repos/extras/pre-commit
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo "test1"
+sleep 1
+echo "test2"
+sleep 1
+echo "test3" \ No newline at end of file
diff --git a/test/repos/lots_of_commits.sh b/test/repos/lots_of_commits.sh
new file mode 100755
index 000000000..7c271f751
--- /dev/null
+++ b/test/repos/lots_of_commits.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -ex; rm -rf repo; mkdir repo; cd repo
+
+git init
+
+i=2
+end=100
+while [ $i -le $end ]; do
+ echo "file${i}" > file${i}
+ git add file${i}
+ git commit -m file${i}
+
+ i=$(($i+1))
+done
+
+echo "unstaged change" > file100
diff --git a/test/merge_conflict.sh b/test/repos/merge_conflict.sh
index f255640b3..8ba234203 100755
--- a/test/merge_conflict.sh
+++ b/test/repos/merge_conflict.sh
@@ -1,20 +1,5 @@
#!/bin/bash
-
-# this script will make a repo with a master and develop branch, where we end up
-# on the master branch and if we try and merge master we get a merge conflict
-
-# call this command from the test directory:
-# ./merge_conflict.sh; cd testrepo; gg; cd ..
-
-# -e means exit if something fails
-# -x means print out simple commands before running them
-set -ex
-
-reponame="merge_conflict"
-
-rm -rf ${reponame}
-mkdir ${reponame}
-cd ${reponame}
+set -ex; rm -rf repo; mkdir repo; cd repo
git init
diff --git a/test/repos/pre_commit_hook.sh b/test/repos/pre_commit_hook.sh
new file mode 100755
index 000000000..8857f4145
--- /dev/null
+++ b/test/repos/pre_commit_hook.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -ex; rm -rf repo; mkdir repo; cd repo
+
+git init
+cp ../pre-commit .git/hooks/pre-commit
+chmod +x .git/hooks/pre-commit
+
+echo "file" > file
+git add file
diff --git a/test/unicode_characters.sh b/test/repos/unicode_characters.sh
index 2db0b3cfa..69ac5e622 100755
--- a/test/unicode_characters.sh
+++ b/test/repos/unicode_characters.sh
@@ -1,20 +1,5 @@
#!/bin/bash
-
-# this script will make a repo with a master and develop branch, where we end up
-# on the master branch and if we try and merge master we get a merge conflict
-
-# call this command from the test directory:
-# ./generate_basic_repo.sh; cd testrepo; gg; cd ..
-
-# -e means exit if something fails
-# -x means print out simple commands before running them
-set -ex
-
-reponame="unicode_characters"
-
-rm -rf ${reponame}
-mkdir ${reponame}
-cd ${reponame}
+set -ex; rm -rf repo; mkdir repo; cd repo
git init