summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-03-26 21:18:10 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-27 10:28:46 +1100
commitae10a5ea8865e04b6369f6a0f9cd8a554ca6cac1 (patch)
tree24d88402c69aaaf2ba056c7e970666954edf021d /test
parent4abd80e2c455cf7d92fa2b3a4389b5baa1ae5aa3 (diff)
add git fetch prune integration test
Diffstat (limited to 'test')
-rw-r--r--test/integration/fetchPrune/config/config.yml10
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/COMMIT_EDITMSG1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/FETCH_HEAD1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/HEAD1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/config21
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/description1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/indexbin0 -> 137 bytes
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/info/exclude7
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/logs/HEAD3
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/master1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/other_branch1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/logs/refs/remotes/origin/master1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52bin0 -> 52 bytes
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5bin0 -> 21 bytes
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1bin0 -> 121 bytes
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/packed-refs1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/refs/heads/master1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/refs/heads/other_branch1
-rw-r--r--test/integration/fetchPrune/expected/.git_keep/refs/remotes/origin/master1
-rw-r--r--test/integration/fetchPrune/expected/myfile11
-rw-r--r--test/integration/fetchPrune/expected_remote/HEAD1
-rw-r--r--test/integration/fetchPrune/expected_remote/config8
-rw-r--r--test/integration/fetchPrune/expected_remote/description1
-rw-r--r--test/integration/fetchPrune/expected_remote/info/exclude7
-rw-r--r--test/integration/fetchPrune/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52bin0 -> 52 bytes
-rw-r--r--test/integration/fetchPrune/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5bin0 -> 21 bytes
-rw-r--r--test/integration/fetchPrune/expected_remote/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1bin0 -> 121 bytes
-rw-r--r--test/integration/fetchPrune/expected_remote/packed-refs2
-rw-r--r--test/integration/fetchPrune/recording.json1
-rw-r--r--test/integration/fetchPrune/setup.sh34
-rw-r--r--test/integration/fetchPrune/test.json4
31 files changed, 111 insertions, 0 deletions
diff --git a/test/integration/fetchPrune/config/config.yml b/test/integration/fetchPrune/config/config.yml
new file mode 100644
index 000000000..a77fb48ed
--- /dev/null
+++ b/test/integration/fetchPrune/config/config.yml
@@ -0,0 +1,10 @@
+disableStartupPopups: true
+git:
+ autoFetch: false
+gui:
+ theme:
+ activeBorderColor:
+ - green
+ - bold
+ SelectedRangeBgcolor:
+ - reverse
diff --git a/test/integration/fetchPrune/expected/.git_keep/COMMIT_EDITMSG b/test/integration/fetchPrune/expected/.git_keep/COMMIT_EDITMSG
new file mode 100644
index 000000000..3829ab872
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/COMMIT_EDITMSG
@@ -0,0 +1 @@
+myfile1
diff --git a/test/integration/fetchPrune/expected/.git_keep/FETCH_HEAD b/test/integration/fetchPrune/expected/.git_keep/FETCH_HEAD
new file mode 100644
index 000000000..8ef89fd5e
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/FETCH_HEAD
@@ -0,0 +1 @@
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 branch 'master' of ../actual_remote
diff --git a/test/integration/fetchPrune/expected/.git_keep/HEAD b/test/integration/fetchPrune/expected/.git_keep/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration/fetchPrune/expected/.git_keep/config b/test/integration/fetchPrune/expected/.git_keep/config
new file mode 100644
index 000000000..6dfad7326
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/config
@@ -0,0 +1,21 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+ precomposeunicode = true
+[user]
+ email = CI@example.com
+ name = CI
+[fetch]
+ prune = true
+[remote "origin"]
+ url = ../actual_remote
+ fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
+[branch "other_branch"]
+ remote = origin
+ merge = refs/heads/other_branch
diff --git a/test/integration/fetchPrune/expected/.git_keep/description b/test/integration/fetchPrune/expected/.git_keep/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration/fetchPrune/expected/.git_keep/index b/test/integration/fetchPrune/expected/.git_keep/index
new file mode 100644
index 000000000..35b2e51a4
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/index
Binary files differ
diff --git a/test/integration/fetchPrune/expected/.git_keep/info/exclude b/test/integration/fetchPrune/expected/.git_keep/info/exclude
new file mode 100644
index 000000000..8e9f2071f
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/info/exclude
@@ -0,0 +1,7 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+.DS_Store
diff --git a/test/integration/fetchPrune/expected/.git_keep/logs/HEAD b/test/integration/fetchPrune/expected/.git_keep/logs/HEAD
new file mode 100644
index 000000000..eac6e78df
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/logs/HEAD
@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 commit (initial): myfile1
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 checkout: moving from master to other_branch
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 checkout: moving from other_branch to master
diff --git a/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/master b/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/master
new file mode 100644
index 000000000..94180e0b5
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/master
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 commit (initial): myfile1
diff --git a/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/other_branch b/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/other_branch
new file mode 100644
index 000000000..7cd5bcbce
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/logs/refs/heads/other_branch
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 branch: Created from HEAD
diff --git a/test/integration/fetchPrune/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/fetchPrune/expected/.git_keep/logs/refs/remotes/origin/master
new file mode 100644
index 000000000..225a60ab5
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/logs/refs/remotes/origin/master
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290938 +1100 fetch origin: storing head
diff --git a/test/integration/fetchPrune/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/fetchPrune/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
Binary files differ
diff --git a/test/integration/fetchPrune/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/fetchPrune/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
new file mode 100644
index 000000000..285df3e5f
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
Binary files differ
diff --git a/test/integration/fetchPrune/expected/.git_keep/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1 b/test/integration/fetchPrune/expected/.git_keep/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1
new file mode 100644
index 000000000..3d352742a
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1
Binary files differ
diff --git a/test/integration/fetchPrune/expected/.git_keep/packed-refs b/test/integration/fetchPrune/expected/.git_keep/packed-refs
new file mode 100644
index 000000000..250f18738
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/packed-refs
@@ -0,0 +1 @@
+# pack-refs with: peeled fully-peeled sorted
diff --git a/test/integration/fetchPrune/expected/.git_keep/refs/heads/master b/test/integration/fetchPrune/expected/.git_keep/refs/heads/master
new file mode 100644
index 000000000..0725115bd
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/refs/heads/master
@@ -0,0 +1 @@
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
diff --git a/test/integration/fetchPrune/expected/.git_keep/refs/heads/other_branch b/test/integration/fetchPrune/expected/.git_keep/refs/heads/other_branch
new file mode 100644
index 000000000..0725115bd
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/refs/heads/other_branch
@@ -0,0 +1 @@
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
diff --git a/test/integration/fetchPrune/expected/.git_keep/refs/remotes/origin/master b/test/integration/fetchPrune/expected/.git_keep/refs/remotes/origin/master
new file mode 100644
index 000000000..0725115bd
--- /dev/null
+++ b/test/integration/fetchPrune/expected/.git_keep/refs/remotes/origin/master
@@ -0,0 +1 @@
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
diff --git a/test/integration/fetchPrune/expected/myfile1 b/test/integration/fetchPrune/expected/myfile1
new file mode 100644
index 000000000..a5bce3fd2
--- /dev/null
+++ b/test/integration/fetchPrune/expected/myfile1
@@ -0,0 +1 @@
+test1
diff --git a/test/integration/fetchPrune/expected_remote/HEAD b/test/integration/fetchPrune/expected_remote/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration/fetchPrune/expected_remote/config b/test/integration/fetchPrune/expected_remote/config
new file mode 100644
index 000000000..0c3c56578
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ ignorecase = true
+ precomposeunicode = true
+[remote "origin"]
+ url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/fetchPrune/./actual
diff --git a/test/integration/fetchPrune/expected_remote/description b/test/integration/fetchPrune/expected_remote/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration/fetchPrune/expected_remote/info/exclude b/test/integration/fetchPrune/expected_remote/info/exclude
new file mode 100644
index 000000000..8e9f2071f
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/info/exclude
@@ -0,0 +1,7 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+.DS_Store
diff --git a/test/integration/fetchPrune/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/fetchPrune/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
Binary files differ
diff --git a/test/integration/fetchPrune/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/fetchPrune/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
new file mode 100644
index 000000000..285df3e5f
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
Binary files differ
diff --git a/test/integration/fetchPrune/expected_remote/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1 b/test/integration/fetchPrune/expected_remote/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1
new file mode 100644
index 000000000..3d352742a
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/objects/f3/ff4de48fa4e8fdb4f3631e58841ba81047d8f1
Binary files differ
diff --git a/test/integration/fetchPrune/expected_remote/packed-refs b/test/integration/fetchPrune/expected_remote/packed-refs
new file mode 100644
index 000000000..0488de20d
--- /dev/null
+++ b/test/integration/fetchPrune/expected_remote/packed-refs
@@ -0,0 +1,2 @@
+# pack-refs with: peeled fully-peeled sorted
+f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 refs/heads/master
diff --git a/test/integration/fetchPrune/recording.json b/test/integration/fetchPrune/recording.json
new file mode 100644
index 000000000..b24cbf0cb
--- /dev/null
+++ b/test/integration/fetchPrune/recording.json
@@ -0,0 +1 @@
+{"KeyEvents":[{"Timestamp":608,"Mod":0,"Key":256,"Ch":102},{"Timestamp":1568,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file
diff --git a/test/integration/fetchPrune/setup.sh b/test/integration/fetchPrune/setup.sh
new file mode 100644
index 000000000..19d0beec7
--- /dev/null
+++ b/test/integration/fetchPrune/setup.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+cd $1
+
+git init
+
+git config user.email "CI@example.com"
+git config user.name "CI"
+
+# we're setting this to ensure that it's honoured by the fetch command
+git config fetch.prune true
+
+echo test1 > myfile1
+git add .
+git commit -am "myfile1"
+
+git checkout -b other_branch
+git checkout master
+
+cd ..
+git clone --bare ./actual actual_remote
+
+cd actual
+
+git remote add origin ../actual_remote
+git fetch origin
+git branch --set-upstream-to=origin/master master
+git branch --set-upstream-to=origin/other_branch other_branch
+
+# unbenownst to our test repo we're removing the branch on the remote, so upon
+# fetching with prune: true we expect git to realise the remote branch is gone
+git -C ../actual_remote branch -d other_branch
diff --git a/test/integration/fetchPrune/test.json b/test/integration/fetchPrune/test.json
new file mode 100644
index 000000000..e358a8c9a
--- /dev/null
+++ b/test/integration/fetchPrune/test.json
@@ -0,0 +1,4 @@
+{
+ "description": "fetch from the remote with the 'prune' option set in the git config",
+ "speed": 10
+}