mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
migrate test for rename branch and pull
This commit is contained in:
parent
277ca706eb
commit
6f709456fe
@ -193,3 +193,9 @@ func (self *Shell) RemoveRemoteBranch(remoteName string, branch string) *Shell {
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Shell) HardReset(ref string) *Shell {
|
||||||
|
self.RunCommand(fmt.Sprintf("git reset --hard %s", ref))
|
||||||
|
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
57
pkg/integration/tests/sync/rename_branch_and_pull.go
Normal file
57
pkg/integration/tests/sync/rename_branch_and_pull.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package sync
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var RenameBranchAndPull = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Rename a branch to no longer match its upstream, then pull from the upstream",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
config.UserConfig.Git.AutoFetch = false
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.EmptyCommit("one")
|
||||||
|
shell.EmptyCommit("two")
|
||||||
|
|
||||||
|
shell.CloneIntoRemote("origin")
|
||||||
|
shell.SetBranchUpstream("master", "origin/master")
|
||||||
|
|
||||||
|
// remove the 'two' commit so that we have something to pull from the remote
|
||||||
|
shell.HardReset("HEAD^")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Commits().
|
||||||
|
Lines(
|
||||||
|
Contains("one"),
|
||||||
|
)
|
||||||
|
|
||||||
|
t.Views().Branches().
|
||||||
|
Focus().
|
||||||
|
Lines(
|
||||||
|
Contains("master"),
|
||||||
|
).
|
||||||
|
Press(keys.Branches.RenameBranch).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("rename branch")).
|
||||||
|
Content(Equals("This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?")).
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Contains("Enter new branch name")).
|
||||||
|
InitialText(Equals("master")).
|
||||||
|
Type("-local").
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
Press(keys.Universal.PullFiles)
|
||||||
|
|
||||||
|
t.Views().Commits().
|
||||||
|
Lines(
|
||||||
|
Contains("two"),
|
||||||
|
Contains("one"),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
@ -66,6 +66,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
diff.DiffAndApplyPatch,
|
diff.DiffAndApplyPatch,
|
||||||
diff.DiffCommits,
|
diff.DiffCommits,
|
||||||
sync.FetchPrune,
|
sync.FetchPrune,
|
||||||
|
sync.RenameBranchAndPull,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTests() []*components.IntegrationTest {
|
func GetTests() []*components.IntegrationTest {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
ref: refs/heads/master
|
|
@ -1,6 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = true
|
|
||||||
[remote "origin"]
|
|
||||||
url = /home/mark/Downloads/gits/lazygit/test/integration/fetchRemoteBranchWithNonmatchingName/actual/./repo
|
|
@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
@ -1,6 +0,0 @@
|
|||||||
# 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]
|
|
||||||
# *~
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
x�ÍA
|
|
||||||
Â0@Q×9Å왉ÓI
|
|
||||||
"BW=FšL°Ð!R"èííÜ~üÜÌÖÄrê»* J®˜d £ÆÂ¬¥Dò‰jà…¯E¸¦<x—ÞýÙv˜f¸MóC?É^›^r³;�L9ŒpF�èŽzLºþÉ�}ëº)¹2ê,Ó
|
|
@ -1,2 +0,0 @@
|
|||||||
x�ŽA
|
|
||||||
à E»öîÅqÆD!”BV9†Ž#
Ä&ííëºúðyïóy¯um]Ú)¢m‚Ù�!–HXJÌ€Åö Á²ëÉ¢ŽxÊ«‹6£Gœ t~L‘†.$è£Òñ�
ßí¹Ÿz^ô4/ùÄzlrã½Þ5ŽÀxƒ¾kŒêm?ÕäO\ÕoY7Aõñ?:l
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
# pack-refs with: peeled fully-peeled sorted
|
|
||||||
b090d7f0029e74de260f7458721b8edd1e618edc refs/heads/master
|
|
@ -1 +0,0 @@
|
|||||||
myfile4
|
|
@ -1 +0,0 @@
|
|||||||
b090d7f0029e74de260f7458721b8edd1e618edc branch 'master' of ../origin
|
|
@ -1 +0,0 @@
|
|||||||
ref: refs/heads/master-local
|
|
@ -1 +0,0 @@
|
|||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f
|
|
@ -1,14 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
[user]
|
|
||||||
email = CI@example.com
|
|
||||||
name = CI
|
|
||||||
[remote "origin"]
|
|
||||||
url = ../origin
|
|
||||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
[branch "master-local"]
|
|
||||||
remote = origin
|
|
||||||
merge = refs/heads/master
|
|
@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
Binary file not shown.
@ -1,6 +0,0 @@
|
|||||||
# 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]
|
|
||||||
# *~
|
|
@ -1,8 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 CI <CI@example.com> 1654108479 +0200 commit (initial): myfile1
|
|
||||||
3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108479 +0200 commit: myfile2
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f 72ee6cc86de71389b9c70e24c7d8c8837e7d3566 CI <CI@example.com> 1654108479 +0200 commit: myfile3
|
|
||||||
72ee6cc86de71389b9c70e24c7d8c8837e7d3566 b090d7f0029e74de260f7458721b8edd1e618edc CI <CI@example.com> 1654108479 +0200 commit: myfile4
|
|
||||||
b090d7f0029e74de260f7458721b8edd1e618edc 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108479 +0200 reset: moving to HEAD~2
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f 0000000000000000000000000000000000000000 CI <CI@example.com> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
|
|
||||||
0000000000000000000000000000000000000000 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f b090d7f0029e74de260f7458721b8edd1e618edc CI <CI@example.com> 1654108482 +0200 pull --no-edit --ff-only origin master: Fast-forward
|
|
@ -1,7 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 CI <CI@example.com> 1654108479 +0200 commit (initial): myfile1
|
|
||||||
3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108479 +0200 commit: myfile2
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f 72ee6cc86de71389b9c70e24c7d8c8837e7d3566 CI <CI@example.com> 1654108479 +0200 commit: myfile3
|
|
||||||
72ee6cc86de71389b9c70e24c7d8c8837e7d3566 b090d7f0029e74de260f7458721b8edd1e618edc CI <CI@example.com> 1654108479 +0200 commit: myfile4
|
|
||||||
b090d7f0029e74de260f7458721b8edd1e618edc 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108479 +0200 reset: moving to HEAD~2
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <CI@example.com> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
|
|
||||||
12d38e54cd419303587ba4613fb1194ec5c9d04f b090d7f0029e74de260f7458721b8edd1e618edc CI <CI@example.com> 1654108482 +0200 pull --no-edit --ff-only origin master: Fast-forward
|
|
@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 b090d7f0029e74de260f7458721b8edd1e618edc CI <CI@example.com> 1654108479 +0200 fetch origin: storing head
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
x�ÍA
|
|
||||||
Â0@Q×9Å왉ÓI
|
|
||||||
"BW=FšL°Ð!R"èííÜ~üÜÌÖÄrê»* J®˜d £ÆÂ¬¥Dò‰jà…¯E¸¦<x—ÞýÙv˜f¸MóC?É^›^r³;�L9ŒpF�èŽzLºþÉ�}ëº)¹2ê,Ó
|
|
@ -1,2 +0,0 @@
|
|||||||
x�ŽA
|
|
||||||
à E»öîÅqÆD!”BV9†Ž#
Ä&ííëºúðyïóy¯um]Ú)¢m‚Ù�!–HXJÌ€Åö Á²ëÉ¢ŽxÊ«‹6£Gœ t~L‘†.$è£Òñ�
ßí¹Ÿz^ô4/ùÄzlrã½Þ5ŽÀxƒ¾kŒêm?ÕäO\ÕoY7Aõñ?:l
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
b090d7f0029e74de260f7458721b8edd1e618edc
|
|
@ -1 +0,0 @@
|
|||||||
b090d7f0029e74de260f7458721b8edd1e618edc
|
|
@ -1 +0,0 @@
|
|||||||
test1
|
|
@ -1 +0,0 @@
|
|||||||
test2
|
|
@ -1 +0,0 @@
|
|||||||
test3
|
|
@ -1 +0,0 @@
|
|||||||
test4
|
|
@ -1 +0,0 @@
|
|||||||
{"KeyEvents":[{"Timestamp":703,"Mod":0,"Key":256,"Ch":108},{"Timestamp":1151,"Mod":0,"Key":256,"Ch":82},{"Timestamp":1692,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2183,"Mod":0,"Key":256,"Ch":45},{"Timestamp":2372,"Mod":0,"Key":256,"Ch":108},{"Timestamp":2498,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2617,"Mod":0,"Key":256,"Ch":99},{"Timestamp":2663,"Mod":0,"Key":256,"Ch":97},{"Timestamp":2724,"Mod":0,"Key":256,"Ch":108},{"Timestamp":3196,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3837,"Mod":0,"Key":256,"Ch":102},{"Timestamp":4854,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":213,"Height":56}]}
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd $1
|
|
||||||
|
|
||||||
git init
|
|
||||||
|
|
||||||
git config user.email "CI@example.com"
|
|
||||||
git config user.name "CI"
|
|
||||||
|
|
||||||
echo test1 > myfile1
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile1"
|
|
||||||
echo test2 > myfile2
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile2"
|
|
||||||
echo test3 > myfile3
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile3"
|
|
||||||
echo test4 > myfile4
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile4"
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
git clone --bare ./repo origin
|
|
||||||
|
|
||||||
cd repo
|
|
||||||
|
|
||||||
git reset --hard HEAD~2
|
|
||||||
git remote add origin ../origin
|
|
||||||
git fetch origin
|
|
||||||
git branch --set-upstream-to=origin/master
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
{ "description": "allow unsetting the upstream of the current branch", "speed": 10 }
|
|
Loading…
x
Reference in New Issue
Block a user