summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-10-05 20:09:34 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-10-10 00:23:01 +1100
commit18f8c3d00a24e5d1d0c2c92f45625437fe3ef478 (patch)
treec2d42c1ac705a5f0837e2034b1d63b1bcae1d38f
parent074fbf6f25484579bb948031947317dbed83e983 (diff)
add merge conflicts integration test
-rw-r--r--pkg/gui/gui_test.go4
-rw-r--r--test/fixtures/mergeConflicts.sh154
-rw-r--r--test/integration/mergeConflicts/recording.json1
-rw-r--r--test/integration/mergeConflicts/snapshot.txt249
4 files changed, 408 insertions, 0 deletions
diff --git a/pkg/gui/gui_test.go b/pkg/gui/gui_test.go
index 7cf20de96..c90da8a64 100644
--- a/pkg/gui/gui_test.go
+++ b/pkg/gui/gui_test.go
@@ -54,6 +54,10 @@ func tests() []integrationTest {
name: "patchBuilding2",
fixture: "updatedFile",
},
+ {
+ name: "mergeConflicts",
+ fixture: "mergeConflicts",
+ },
}
}
diff --git a/test/fixtures/mergeConflicts.sh b/test/fixtures/mergeConflicts.sh
new file mode 100644
index 000000000..311f15b3d
--- /dev/null
+++ b/test/fixtures/mergeConflicts.sh
@@ -0,0 +1,154 @@
+#!/bin/sh
+
+git init
+git config user.email "CI@example.com"
+git config user.name "CI"
+
+
+function add_spacing {
+ for i in {1..60}
+ do
+ echo "..." >> $1
+ done
+}
+
+mkdir directory
+echo "test1" > directory/file
+echo "test1" > directory/file2
+
+
+echo "Here is a story that has been told throuhg the ages" >> file1
+
+git add file1
+git add directory
+git commit -m "first commit"
+
+git checkout -b feature/cherry-picking
+
+echo "this is file number 1 that I'm going to cherry-pick" > cherrypicking1
+echo "this is file number 2 that I'm going to cherry-pick" > cherrypicking2
+
+git add .
+
+git commit -am "first commit freshman year"
+
+echo "this is file number 3 that I'm going to cherry-pick" > cherrypicking3
+
+git add .
+
+git commit -am "second commit subway eat fresh"
+
+echo "this is file number 4 that I'm going to cherry-pick" > cherrypicking4
+
+git add .
+
+git commit -am "third commit fresh"
+
+echo "this is file number 5 that I'm going to cherry-pick" > cherrypicking5
+
+git add .
+
+git commit -am "fourth commit cool"
+
+echo "this is file number 6 that I'm going to cherry-pick" > cherrypicking6
+
+git add .
+
+git commit -am "fifth commit nice"
+
+echo "this is file number 7 that I'm going to cherry-pick" > cherrypicking7
+
+git add .
+
+git commit -am "sixth commit haha"
+
+echo "this is file number 8 that I'm going to cherry-pick" > cherrypicking8
+
+git add .
+
+git commit -am "seventh commit yeah"
+
+echo "this is file number 9 that I'm going to cherry-pick" > cherrypicking9
+
+git add .
+
+git commit -am "eighth commit woo"
+
+
+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
+echo "test2" > directory/file
+echo "test2" > directory/file2
+git add directory
+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
+echo "test3" > directory/file
+echo "test3" > directory/file2
+git add directory
+git commit -m "first commit on master"
+
+
+git checkout develop
+echo "once upon a time there was a mouse" >> file3
+git add file3
+git commit -m "second commit on develop"
+
+
+git checkout master
+echo "once upon a time there was a horse" >> file3
+git add file3
+git commit -m "second commit on master"
+
+
+git checkout develop
+echo "once upon a time there was a mouse" >> file4
+git add file4
+git commit -m "third commit on develop"
+
+
+git checkout master
+echo "once upon a time there was a horse" >> file4
+git add file4
+git commit -m "third commit on master"
+
+
+git checkout develop
+echo "once upon a time there was a mouse" >> file5
+git add file5
+git commit -m "fourth commit on develop"
+
+
+git checkout master
+echo "once upon a time there was a horse" >> file5
+git add file5
+git commit -m "fourth commit on master"
+
+
+# this is for the autostash feature
+
+git checkout -b base_branch
+
+echo "original1\noriginal2\noriginal3" > file
+git add file
+git commit -m "file"
+
+git checkout -b other_branch
+
+git checkout base_branch
+
+echo "new1\noriginal2\noriginal3" > file
+git add file
+git commit -m "file changed"
+
+git checkout other_branch
+
+echo "new2\noriginal2\noriginal3" > file
diff --git a/test/integration/mergeConflicts/recording.json b/test/integration/mergeConflicts/recording.json
new file mode 100644
index 000000000..1ee1b28e8
--- /dev/null
+++ b/test/integration/mergeConflicts/recording.json
@@ -0,0 +1 @@
+[{"Timestamp":16,"Event":{"Type":1,"Mod":0,"Key":0,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":0,"Bytes":null}},{"Timestamp":565,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":99,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"Yw=="}},{"Timestamp":1029,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":1509,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":97,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"YQ=="}},{"Timestamp":1573,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":115,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"cw=="}},{"Timestamp":1613,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":100,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"ZA=="}},{"Timestamp":1868,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":2413,"Event":{"Type":0,"Mod":0,"Key":65514,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":3,"Bytes":"G09D"}},{"Timestamp":2708,"Event":{"Type":0,"Mod":0,"Key":65516,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":3,"Bytes":"G09C"}},{"Timestamp":3357,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":77,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"TQ=="}},{"Timestamp":3757,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":4509,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":5045,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":5356,"Event":{"Type":0,"Mod":0,"Key":65516,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":3,"Bytes":"G09C"}},{"Timestamp":5677,"Event":{"Type":0,"Mod":0,"Key":32,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"IA=="}},{"Timestamp":6365,"Event":{"Type":0,"Mod":0,"Key":13,"Ch":0,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"DQ=="}},{"Timestamp":7029,"Event":{"Type":0,"Mod":0,"Key":0,"Ch":113,"Width":0,"Height":0,"Err":null,"MouseX":0,"MouseY":0,"N":1,"Bytes":"cQ=="}}] \ No newline at end of file
diff --git a/test/integration/mergeConflicts/snapshot.txt b/test/integration/mergeConflicts/snapshot.txt
new file mode 100644
index 000000000..3d1d1e31d
--- /dev/null
+++ b/test/integration/mergeConflicts/snapshot.txt
@@ -0,0 +1,249 @@
+On branch other_branch
+nothing to commit, working tree clean
+cat: ./directory: Is a directory
+new1
+original2
+original3
+Here is a story that has been told throuhg the ages
+once upon a time there was a cat
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+...
+once upon a time there was another cat
+once upon a time there was a horse
+once upon a time there was a horse
+once upon a time there was a horse
+Merge branch 'base_branch' into other_branch
+
+asd
+
+
+diff --git a/file b/file
+index 37ec558..51c0b8a 100644
+--- a/file
++++ b/file
+@@ -1,3 +1,3 @@
+-original1
++new2
+ original2
+ original3
+file changed
+
+
+diff --git a/file b/file
+index 37ec558..fa90625 100644
+--- a/file
++++ b/file
+@@ -1,3 +1,3 @@
+-original1
++new1
+ original2
+ original3
+file
+
+
+diff --git a/file b/file
+new file mode 100644
+index 0000000..37ec558
+--- /dev/null
++++ b/file
+@@ -0,0 +1,3 @@
++original1
++original2
++original3
+fourth commit on master
+
+
+diff --git a/file5 b/file5
+new file mode 100644
+index 0000000..e3ae5c6
+--- /dev/null
++++ b/file5
+@@ -0,0 +1 @@
++once upon a time there was a horse
+third commit on master
+
+
+diff --git a/file4 b/file4
+new file mode 100644
+index 0000000..e3ae5c6
+--- /dev/null
++++ b/file4
+@@ -0,0 +1 @@
++once upon a time there was a horse
+second commit on master
+
+
+diff --git a/file3 b/file3
+new file mode 100644
+index 0000000..e3ae5c6
+--- /dev/null
++++ b/file3
+@@ -0,0 +1 @@
++once upon a time there was a horse
+first commit on master
+
+
+diff --git a/directory/file b/directory/file
+index a5bce3f..df6b0d2 100644
+--- a/directory/file
++++ b/directory/file
+@@ -1 +1 @@
+-test1
++test3
+diff --git a/directory/file2 b/directory/file2
+index a5bce3f..df6b0d2 100644
+--- a/directory/file2
++++ b/directory/file2
+@@ -1 +1 @@
+-test1
++test3
+diff --git a/file1 b/file1
+index 88c39cd..dcd3485 100644
+--- a/file1
++++ b/file1
+@@ -1 +1,63 @@
+ Here is a story that has been told throuhg the ages
++once upon a time there was a cat
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++...
++once upon a time there was another cat
+first commit
+
+
+diff --git a/directory/file b/directory/file
+new file mode 100644
+index 0000000..a5bce3f
+--- /dev/null
++++ b/directory/file
+@@ -0,0 +1 @@
++test1
+diff --git a/directory/file2 b/directory/file2
+new file mode 100644
+index 0000000..a5bce3f
+--- /dev/null
++++ b/directory/file2
+@@ -0,0 +1 @@
++test1
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..88c39cd
+--- /dev/null
++++ b/file1
+@@ -0,0 +1 @@
++Here is a story that has been told throuhg the ages