aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2018-05-17 14:02:34 +0100
committerAdam Spiers <git@adamspiers.org>2018-05-17 14:11:07 +0100
commitd34f491f98a4bd2108260ed34230c9d2890c2b45 (patch)
tree28f629e99f0ac0c011a28c262d745ad43c99ca54 /tests
parentd5ac51414eddd152bb9ded750cbbf99c45709337 (diff)
downloadgit-deps-d34f491f98a4bd2108260ed34230c9d2890c2b45.tar.gz
create-repo.sh: refactoring into new edit function
Diffstat (limited to 'tests')
-rwxr-xr-xtests/create-repo.sh27
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/create-repo.sh b/tests/create-repo.sh
index 029161c..ee1310e 100755
--- a/tests/create-repo.sh
+++ b/tests/create-repo.sh
@@ -28,6 +28,15 @@ tag () {
read
}
+edit () {
+ file="$1"
+ line="$2"
+ new="$3"
+ sed -i "s/^$line.*/$line $new/" $file
+ git commit -am "$file: change $line to $line $new"
+ tag $file-$line-$new
+}
+
main () {
rm -rf $test_repo
mkdir $test_repo
@@ -42,24 +51,14 @@ main () {
done
# 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
+ edit file-a three a # depends on file-a tag
+ edit file-b three a # depends on file-b tag
# 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
+ edit file-a eight a # depends on file-a tag
# 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
+ edit file-a three b # depends on file-a-three-a tag
}
main