1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-11 11:42:12 +02:00

migrate discard old file change test

This commit is contained in:
Jesse Duffield 2022-12-28 13:01:32 +11:00
parent f3fa9ec2d1
commit ae07cf5506
38 changed files with 58 additions and 80 deletions

View File

@ -0,0 +1,57 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiscardOldFileChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding a single file from an old commit (does rebase in background to remove the file but retain the other one)",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file0", "file0")
shell.Commit("first commit")
shell.CreateFileAndAdd("file1", "file2")
shell.CreateFileAndAdd("fileToRemove", "fileToRemove")
shell.Commit("commit to change")
shell.CreateFileAndAdd("file3", "file3")
shell.Commit("third commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("third commit").IsSelected(),
Contains("commit to change"),
Contains("first commit"),
).
SelectNextItem().
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("file1").IsSelected(),
Contains("fileToRemove"),
).
SelectNextItem().
Press(keys.Universal.Remove)
t.ExpectPopup().Confirmation().
Title(Equals("Discard file changes")).
Content(Contains("Are you sure you want to discard this commit's changes to this file?")).
Confirm()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("file1").IsSelected(),
)
t.FileSystem().PathNotPresent("fileToRemove")
},
})

View File

@ -45,6 +45,7 @@ var tests = []*components.IntegrationTest{
commit.Staged,
commit.Unstaged,
commit.StagedWithoutHooks,
commit.DiscardOldFileChange,
custom_commands.Basic,
custom_commands.FormPrompts,
custom_commands.MenuFromCommand,

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1 +0,0 @@
7880a9728615a4d196df39600a0c8c71b40d96d6

View File

@ -1,10 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[user]
email = CI@example.com
name = CI

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,7 +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]
# *~
.DS_Store

View File

@ -1,9 +0,0 @@
0000000000000000000000000000000000000000 b7a702b642978f2a9b1af9c1c67b22127af78c92 CI <CI@example.com> 1641697108 +1100 commit (initial): file0
b7a702b642978f2a9b1af9c1c67b22127af78c92 7880a9728615a4d196df39600a0c8c71b40d96d6 CI <CI@example.com> 1641697108 +1100 commit: twoFiles
7880a9728615a4d196df39600a0c8c71b40d96d6 af6725ba23f43a286deff0747476d7874113df1e CI <CI@example.com> 1641697108 +1100 commit: file2
af6725ba23f43a286deff0747476d7874113df1e af6725ba23f43a286deff0747476d7874113df1e CI <CI@example.com> 1641697111 +1100 rebase: updating HEAD
af6725ba23f43a286deff0747476d7874113df1e b7a702b642978f2a9b1af9c1c67b22127af78c92 CI <CI@example.com> 1641697111 +1100 rebase -i (start): checkout b7a702b642978f2a9b1af9c1c67b22127af78c92
b7a702b642978f2a9b1af9c1c67b22127af78c92 7880a9728615a4d196df39600a0c8c71b40d96d6 CI <CI@example.com> 1641697111 +1100 rebase -i: fast-forward
7880a9728615a4d196df39600a0c8c71b40d96d6 d14505f281a54cda96fc5fb8cd4b4ee14bae6264 CI <CI@example.com> 1641697111 +1100 commit (amend): twoFiles
d14505f281a54cda96fc5fb8cd4b4ee14bae6264 225ad83faa797c1831a2bc956a21e2d472f21443 CI <CI@example.com> 1641697111 +1100 rebase -i (pick): file2
225ad83faa797c1831a2bc956a21e2d472f21443 225ad83faa797c1831a2bc956a21e2d472f21443 CI <CI@example.com> 1641697111 +1100 rebase -i (finish): returning to refs/heads/master

View File

@ -1,4 +0,0 @@
0000000000000000000000000000000000000000 b7a702b642978f2a9b1af9c1c67b22127af78c92 CI <CI@example.com> 1641697108 +1100 commit (initial): file0
b7a702b642978f2a9b1af9c1c67b22127af78c92 7880a9728615a4d196df39600a0c8c71b40d96d6 CI <CI@example.com> 1641697108 +1100 commit: twoFiles
7880a9728615a4d196df39600a0c8c71b40d96d6 af6725ba23f43a286deff0747476d7874113df1e CI <CI@example.com> 1641697108 +1100 commit: file2
af6725ba23f43a286deff0747476d7874113df1e 225ad83faa797c1831a2bc956a21e2d472f21443 CI <CI@example.com> 1641697111 +1100 rebase -i (finish): refs/heads/master onto b7a702b642978f2a9b1af9c1c67b22127af78c92

View File

@ -1 +0,0 @@
x��±j1DSßW¨„]iO+™ ®\åVÚD>s'C>?jÒ‡é†÷¦n½ çWz»™Ãd9±’VÐc\3{Z3VeÈæ…SÆD­.Ùí>œ´È~-âC£ >EµÖ€i&*'&Ä  í�‡ª%ªa›ZÔ¨*ÁG)LÃ"ÏqÛvw¹º÷Ëõl?ÒßöV·þá0Æ̈è^–ÙÎÃþ‰/Ÿw×å˜üÉÍ™írÜ~ìKò

View File

@ -1,2 +0,0 @@
x�ŽA
Â0E]ç³$“¦™DD„®zŒi2Á‚iK�Ðã›�{y»ÏûðâZÊ\Á �ê.è%xJ�å<¡A×2¶é †Éô6Gµñ.KÎŽL?±é²íØx—$gM¶áy²ˆ]Ê(Š?õ¹î0ŒpƇ\¶—\âZî€Î¢ „ˆpFÔZµµEUùSWó’ä€u�Âïöºþª Ï/1ê ÜZ@¼

View File

@ -1,3 +0,0 @@
x�ÎA
à @Ñ®=…ûB™‰qT(¥�UŽ1Ž# Ä& =~s„nñekméÓp釪�,R‹ó ^krÁåÌ©xrN*)…])Þì|è»Û#p
C$ô<LTªKÀ QæÊidøÓ_Ûa§ÙÞ§ù©_nûª7ÙÚÃ"�H) D{E0§žS]ÿÌM]V̈‘9n

View File

@ -1,2 +0,0 @@
x�ÍA
Â0Fa×9Å왉cÒ¡«#iþ`¡¡R"x|{·�Þ¼µ¶tÕSß\b6³’åC*ð�«Vö¹ToPSõ.}úkÛiœè>NO|S{¯¸Ì[{�•`Qx ³³;ê1éø“»º¬`÷Ü7+ò

View File

@ -1,2 +0,0 @@
x+)JMU03c040031QHヒフI5`ーアコイ燹ヨカwチ�w.ス��モ[H
矢y�5�来ミ(桍ァ ^-ンW(x9

View File

@ -1 +0,0 @@
225ad83faa797c1831a2bc956a21e2d472f21443

View File

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":635,"Mod":0,"Key":259,"Ch":0},{"Timestamp":899,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1227,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1571,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1971,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2322,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2731,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3707,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}

View File

@ -1,26 +0,0 @@
#!/bin/sh
set -e
cd $1
git init
git config user.email "CI@example.com"
git config user.name "CI"
echo test0 > file0
git add .
git commit -am file0
echo test1 > file1
echo testZ > fileZ
git add .
git commit -am twoFiles
echo test2 > file2
git add .
git commit -am file2
echo test3 > file3
git add .

View File

@ -1,4 +0,0 @@
{
"description": "Discarding a single file from an old commit (does rebase in background to remove the file but retain the other one)",
"speed": 5
}