1
1
#! /bin/bash
2
+ # ./git-imerge-test-create.sh
2
3
# Written by Wilson Mar ([email protected] )
3
- # This creates commits
4
+ # This creates the conditions for testing Michael Haggerty's "git imerge",
5
+ # as described in https://wilsonmar.github.io/git-imerge
6
+ #
7
+ # Before running this, copy this file to the folder where you want the test repo created,
8
+ # then chmod 555 git-imerge-test-create.sh
9
+ # Running this creates a folder above the script folder
10
+ # and creates a file named somefile.md in both the floob branch and "frob" branch.
4
11
# This file is in https://github.com/wilsonmar/git-utilities/git-imerge-test-create.sh
5
12
13
+
6
14
function conflict { # $1=letter $2=cnt number
7
15
x=" $1$2 "
8
16
if [ $x = B2 ]|| [ $x = G7 ]|| [ $x = I9 ]; then
9
- commit " $x tlub " $1 tlub
10
- commit " $x master " $2 master
17
+ commit " $x frob " $1 frob
18
+ commit " $x floob " $2 floob
11
19
else
12
- commit " $x " $1 tlub
13
- commit " $x " $2 master
20
+ commit " $x " $1 frob
21
+ commit " $x " $2 floob
14
22
fi
15
23
}
16
24
@@ -25,10 +33,10 @@ function commit { # $1=content, $2=msg
25
33
26
34
# #########
27
35
28
- echo " ## Change directory up to avoid using git-utilities own repo:"
29
- cd ..
30
- mkdir $1
31
- cd $1
36
+ # echo "## Change directory up to avoid using git-utilities own repo:"
37
+ # cd ..
38
+ # mkdir $1
39
+ # cd $1
32
40
33
41
echo " ## Deleting .git and somefile.md from previous run:"
34
42
rm -rf .git
@@ -38,9 +46,9 @@ echo "## Initializing repo with commit and branches:"
38
46
git init
39
47
touch somefile.md
40
48
git add somefile.md
41
- git commit -m" Initial commit somefile.md "
42
- git branch tlub
43
- git branch master
49
+ git commit -m" 0 "
50
+ git branch frob
51
+ git branch floob
44
52
git branch -avv
45
53
46
54
echo " ## Generating commits in branches:"
@@ -51,12 +59,20 @@ for i in ${letters[@]}; do
51
59
cnt=$(( cnt+ 1 )) # increment
52
60
done
53
61
54
- echo " ## Verifying contents of branch tlub and file somefile.md:"
62
+ echo " ## Verifying contents of branch frob and file somefile.md:"
55
63
git log --pretty=format:" %h %s %ad" --graph --since=1.days --date=relative;
56
- git checkout tlub
64
+ git checkout frob
57
65
cat somefile.md
58
- echo " ## Verifying contents of branch master and file somefile.md:"
66
+ echo " ## Verifying contents of branch floob and file somefile.md:"
59
67
git log --pretty=format:" %h %s %ad" --graph --since=1.days --date=relative;
60
- git checkout master
68
+ git checkout floob
61
69
cat somefile.md
62
- # ls -al
70
+ git branch -avv
71
+ # ls -al
72
+ # You should now have:
73
+ # 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ' ← floob
74
+ # \
75
+ # A -- B -- C --- D --- E --- F --- G --- H --- I ← branch
76
+ git checkout frob
77
+ git-imerge start --name=NAME --goal=full floob
78
+ git imerge diagram --name=NAME
0 commit comments