From 98c22a36fdaf8806f8fafe8f1e23e53f8e97658d Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 12 Aug 2018 15:54:59 +1000 Subject: rearrange test repo generators --- test/case_insensitive_checkouts.sh | 30 ------------------- test/lots_of_commits.sh | 30 ------------------- test/merge_conflict.sh | 49 -------------------------------- test/repos/case_insensitive_checkouts.sh | 16 +++++++++++ test/repos/extras/pre-commit | 7 +++++ test/repos/lots_of_commits.sh | 16 +++++++++++ test/repos/merge_conflict.sh | 34 ++++++++++++++++++++++ test/repos/pre_commit_hook.sh | 9 ++++++ test/repos/unicode_characters.sh | 20 +++++++++++++ test/unicode_characters.sh | 35 ----------------------- 10 files changed, 102 insertions(+), 144 deletions(-) delete mode 100755 test/case_insensitive_checkouts.sh delete mode 100755 test/lots_of_commits.sh delete mode 100755 test/merge_conflict.sh create mode 100755 test/repos/case_insensitive_checkouts.sh create mode 100644 test/repos/extras/pre-commit create mode 100755 test/repos/lots_of_commits.sh create mode 100755 test/repos/merge_conflict.sh create mode 100755 test/repos/pre_commit_hook.sh create mode 100755 test/repos/unicode_characters.sh delete mode 100755 test/unicode_characters.sh (limited to 'test') 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/merge_conflict.sh b/test/merge_conflict.sh deleted file mode 100755 index f255640b3..000000000 --- a/test/merge_conflict.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/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} - -git init - -function add_spacing { - for i in {1..60} - do - echo "..." >> $1 - done -} - -echo "Here is a story that has been told throuhg the ages" >> file1 - -git add file1 -git commit -m "first commit" - -git checkout -b develop - -echo "once upon a time there was a dog" >> file1 -add_spacing file1 -echo "once upon a time there was another dog" >> file1 -git add file1 -git commit -m "first commit on develop" - -git checkout master - -echo "once upon a time there was a cat" >> file1 -add_spacing file1 -echo "once upon a time there was another cat" >> file1 -git add file1 -git commit -m "first commit on develop" - -git merge develop # should have a merge conflict here 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/repos/merge_conflict.sh b/test/repos/merge_conflict.sh new file mode 100755 index 000000000..8ba234203 --- /dev/null +++ b/test/repos/merge_conflict.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -ex; rm -rf repo; mkdir repo; cd repo + +git init + +function add_spacing { + for i in {1..60} + do + echo "..." >> $1 + done +} + +echo "Here is a story that has been told throuhg the ages" >> file1 + +git add file1 +git commit -m "first commit" + +git checkout -b develop + +echo "once upon a time there was a dog" >> file1 +add_spacing file1 +echo "once upon a time there was another dog" >> file1 +git add file1 +git commit -m "first commit on develop" + +git checkout master + +echo "once upon a time there was a cat" >> file1 +add_spacing file1 +echo "once upon a time there was another cat" >> file1 +git add file1 +git commit -m "first commit on develop" + +git merge develop # should have a merge conflict here 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/repos/unicode_characters.sh b/test/repos/unicode_characters.sh new file mode 100755 index 000000000..69ac5e622 --- /dev/null +++ b/test/repos/unicode_characters.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -ex; rm -rf repo; mkdir repo; cd repo + +git init + +# Add some ansi, unicode, zero width joiner caracters +cat <> charstest.txt +ANSI Œ (U+0152 Œ Latin capital ligature OE Latin Extended-A) + ¥ (0xA5 U+00A5 ¥ yes sign) + ƒ (0x83 U+0192 ƒ Latin small letter f with hook) +ZWJ https://en.wikipedia.org/wiki/Zero-width_joiner / https://unicode.org/Public/emoji/4.0/emoji-zwj-sequences.txt 👶(👨‍👦) +UNICODE ☆ 🤓 え 术 +EOT +git add charstest.txt +git commit -m "Test chars Œ¥ƒ👶👨‍👦☆ 🤓 え 术 commit" +echo "我喜歡編碼" >> charstest.txt +echo "நான் குறியீடு விரும்புகிறேன்" >> charstest.txt +git add charstest.txt +git commit -m "Test chars 我喜歡編碼 நான் குறியீடு விரும்புகிறேன் commit" + diff --git a/test/unicode_characters.sh b/test/unicode_characters.sh deleted file mode 100755 index 2db0b3cfa..000000000 --- a/test/unicode_characters.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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} - -git init - -# Add some ansi, unicode, zero width joiner caracters -cat <> charstest.txt -ANSI Œ (U+0152 Œ Latin capital ligature OE Latin Extended-A) - ¥ (0xA5 U+00A5 ¥ yes sign) - ƒ (0x83 U+0192 ƒ Latin small letter f with hook) -ZWJ https://en.wikipedia.org/wiki/Zero-width_joiner / https://unicode.org/Public/emoji/4.0/emoji-zwj-sequences.txt 👶(👨‍👦) -UNICODE ☆ 🤓 え 术 -EOT -git add charstest.txt -git commit -m "Test chars Œ¥ƒ👶👨‍👦☆ 🤓 え 术 commit" -echo "我喜歡編碼" >> charstest.txt -echo "நான் குறியீடு விரும்புகிறேன்" >> charstest.txt -git add charstest.txt -git commit -m "Test chars 我喜歡編碼 நான் குறியீடு விரும்புகிறேன் commit" - -- cgit v1.2.3