mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
Merge pull request #2220 from Ryooooooga/rename-stash
This commit is contained in:
commit
36c6462a53
@ -223,6 +223,7 @@ keybinding:
|
|||||||
viewBisectOptions: 'b'
|
viewBisectOptions: 'b'
|
||||||
stash:
|
stash:
|
||||||
popStash: 'g'
|
popStash: 'g'
|
||||||
|
renameStash: 'r'
|
||||||
commitFiles:
|
commitFiles:
|
||||||
checkoutCommitFile: 'c'
|
checkoutCommitFile: 'c'
|
||||||
main:
|
main:
|
||||||
|
@ -238,6 +238,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: pop
|
<kbd>g</kbd>: pop
|
||||||
<kbd>d</kbd>: drop
|
<kbd>d</kbd>: drop
|
||||||
<kbd>n</kbd>: new branch
|
<kbd>n</kbd>: new branch
|
||||||
|
<kbd>r</kbd>: rename stash
|
||||||
<kbd>enter</kbd>: view selected item's files
|
<kbd>enter</kbd>: view selected item's files
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: pop
|
<kbd>g</kbd>: pop
|
||||||
<kbd>d</kbd>: drop
|
<kbd>d</kbd>: drop
|
||||||
<kbd>n</kbd>: 新しいブランチを作成
|
<kbd>n</kbd>: 新しいブランチを作成
|
||||||
|
<kbd>r</kbd>: Stashを変更
|
||||||
<kbd>enter</kbd>: view selected item's files
|
<kbd>enter</kbd>: view selected item's files
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: pop
|
<kbd>g</kbd>: pop
|
||||||
<kbd>d</kbd>: drop
|
<kbd>d</kbd>: drop
|
||||||
<kbd>n</kbd>: 새 브랜치 생성
|
<kbd>n</kbd>: 새 브랜치 생성
|
||||||
|
<kbd>r</kbd>: rename stash
|
||||||
<kbd>enter</kbd>: view selected item's files
|
<kbd>enter</kbd>: view selected item's files
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -238,6 +238,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: pop
|
<kbd>g</kbd>: pop
|
||||||
<kbd>d</kbd>: laten vallen
|
<kbd>d</kbd>: laten vallen
|
||||||
<kbd>n</kbd>: nieuwe branch
|
<kbd>n</kbd>: nieuwe branch
|
||||||
|
<kbd>r</kbd>: rename stash
|
||||||
<kbd>enter</kbd>: bekijk gecommite bestanden
|
<kbd>enter</kbd>: bekijk gecommite bestanden
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: wyciągnij
|
<kbd>g</kbd>: wyciągnij
|
||||||
<kbd>d</kbd>: porzuć
|
<kbd>d</kbd>: porzuć
|
||||||
<kbd>n</kbd>: nowa gałąź
|
<kbd>n</kbd>: nowa gałąź
|
||||||
|
<kbd>r</kbd>: rename stash
|
||||||
<kbd>enter</kbd>: przeglądaj pliki commita
|
<kbd>enter</kbd>: przeglądaj pliki commita
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -264,6 +264,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
|||||||
<kbd>g</kbd>: 应用并删除
|
<kbd>g</kbd>: 应用并删除
|
||||||
<kbd>d</kbd>: 删除
|
<kbd>d</kbd>: 删除
|
||||||
<kbd>n</kbd>: 新分支
|
<kbd>n</kbd>: 新分支
|
||||||
|
<kbd>r</kbd>: rename stash
|
||||||
<kbd>enter</kbd>: 查看提交的文件
|
<kbd>enter</kbd>: 查看提交的文件
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package git_commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||||
@ -46,6 +47,19 @@ func (self *StashCommands) Save(message string) error {
|
|||||||
return self.cmd.New("git stash save " + self.cmd.Quote(message)).Run()
|
return self.cmd.New("git stash save " + self.cmd.Quote(message)).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *StashCommands) Store(sha string, message string) error {
|
||||||
|
trimmedMessage := strings.Trim(message, " \t")
|
||||||
|
if len(trimmedMessage) > 0 {
|
||||||
|
return self.cmd.New(fmt.Sprintf("git stash store %s -m %s", self.cmd.Quote(sha), self.cmd.Quote(trimmedMessage))).Run()
|
||||||
|
}
|
||||||
|
return self.cmd.New(fmt.Sprintf("git stash store %s", self.cmd.Quote(sha))).Run()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *StashCommands) Sha(index int) (string, error) {
|
||||||
|
sha, _, err := self.cmd.New(fmt.Sprintf("git rev-parse refs/stash@{%d}", index)).DontLog().RunWithOutputs()
|
||||||
|
return strings.Trim(sha, "\r\n"), err
|
||||||
|
}
|
||||||
|
|
||||||
func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj {
|
func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj {
|
||||||
cmdStr := fmt.Sprintf("git stash show -p --stat --color=%s --unified=%d stash@{%d}", self.UserConfig.Git.Paging.ColorArg, self.UserConfig.Git.DiffContextSize, index)
|
cmdStr := fmt.Sprintf("git stash show -p --stat --color=%s --unified=%d stash@{%d}", self.UserConfig.Git.Paging.ColorArg, self.UserConfig.Git.DiffContextSize, index)
|
||||||
|
|
||||||
@ -109,3 +123,21 @@ func (self *StashCommands) SaveStagedChanges(message string) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *StashCommands) Rename(index int, message string) error {
|
||||||
|
sha, err := self.Sha(index)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := self.Drop(index); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = self.Store(sha, message)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestStashDrop(t *testing.T) {
|
func TestStashDrop(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t).
|
runner := oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs([]string{"stash", "drop", "stash@{1}"}, "", nil)
|
ExpectGitArgs([]string{"stash", "drop", "stash@{1}"}, "Dropped refs/stash@{1} (98e9cca532c37c766107093010c72e26f2c24c04)\n", nil)
|
||||||
instance := buildStashCommands(commonDeps{runner: runner})
|
instance := buildStashCommands(commonDeps{runner: runner})
|
||||||
|
|
||||||
assert.NoError(t, instance.Drop(1))
|
assert.NoError(t, instance.Drop(1))
|
||||||
@ -44,6 +44,59 @@ func TestStashSave(t *testing.T) {
|
|||||||
runner.CheckForMissingCalls()
|
runner.CheckForMissingCalls()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStashStore(t *testing.T) {
|
||||||
|
type scenario struct {
|
||||||
|
testName string
|
||||||
|
sha string
|
||||||
|
message string
|
||||||
|
expected []string
|
||||||
|
}
|
||||||
|
|
||||||
|
scenarios := []scenario{
|
||||||
|
{
|
||||||
|
testName: "Non-empty message",
|
||||||
|
sha: "0123456789abcdef",
|
||||||
|
message: "New stash name",
|
||||||
|
expected: []string{"stash", "store", "0123456789abcdef", "-m", "New stash name"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Empty message",
|
||||||
|
sha: "0123456789abcdef",
|
||||||
|
message: "",
|
||||||
|
expected: []string{"stash", "store", "0123456789abcdef"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Space message",
|
||||||
|
sha: "0123456789abcdef",
|
||||||
|
message: " ",
|
||||||
|
expected: []string{"stash", "store", "0123456789abcdef"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range scenarios {
|
||||||
|
s := s
|
||||||
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
|
runner := oscommands.NewFakeRunner(t).
|
||||||
|
ExpectGitArgs(s.expected, "", nil)
|
||||||
|
instance := buildStashCommands(commonDeps{runner: runner})
|
||||||
|
|
||||||
|
assert.NoError(t, instance.Store(s.sha, s.message))
|
||||||
|
runner.CheckForMissingCalls()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStashSha(t *testing.T) {
|
||||||
|
runner := oscommands.NewFakeRunner(t).
|
||||||
|
ExpectGitArgs([]string{"rev-parse", "refs/stash@{5}"}, "14d94495194651adfd5f070590df566c11d28243\n", nil)
|
||||||
|
instance := buildStashCommands(commonDeps{runner: runner})
|
||||||
|
|
||||||
|
sha, err := instance.Sha(5)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, "14d94495194651adfd5f070590df566c11d28243", sha)
|
||||||
|
runner.CheckForMissingCalls()
|
||||||
|
}
|
||||||
|
|
||||||
func TestStashStashEntryCmdObj(t *testing.T) {
|
func TestStashStashEntryCmdObj(t *testing.T) {
|
||||||
type scenario struct {
|
type scenario struct {
|
||||||
testName string
|
testName string
|
||||||
@ -79,3 +132,50 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStashRename(t *testing.T) {
|
||||||
|
type scenario struct {
|
||||||
|
testName string
|
||||||
|
index int
|
||||||
|
message string
|
||||||
|
expectedShaCmd []string
|
||||||
|
shaResult string
|
||||||
|
expectedDropCmd []string
|
||||||
|
expectedStoreCmd []string
|
||||||
|
}
|
||||||
|
|
||||||
|
scenarios := []scenario{
|
||||||
|
{
|
||||||
|
testName: "Default case",
|
||||||
|
index: 3,
|
||||||
|
message: "New message",
|
||||||
|
expectedShaCmd: []string{"rev-parse", "refs/stash@{3}"},
|
||||||
|
shaResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n",
|
||||||
|
expectedDropCmd: []string{"stash", "drop", "stash@{3}"},
|
||||||
|
expectedStoreCmd: []string{"stash", "store", "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd", "-m", "New message"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Empty message",
|
||||||
|
index: 4,
|
||||||
|
message: "",
|
||||||
|
expectedShaCmd: []string{"rev-parse", "refs/stash@{4}"},
|
||||||
|
shaResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n",
|
||||||
|
expectedDropCmd: []string{"stash", "drop", "stash@{4}"},
|
||||||
|
expectedStoreCmd: []string{"stash", "store", "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range scenarios {
|
||||||
|
s := s
|
||||||
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
|
runner := oscommands.NewFakeRunner(t).
|
||||||
|
ExpectGitArgs(s.expectedShaCmd, s.shaResult, nil).
|
||||||
|
ExpectGitArgs(s.expectedDropCmd, "", nil).
|
||||||
|
ExpectGitArgs(s.expectedStoreCmd, "", nil)
|
||||||
|
instance := buildStashCommands(commonDeps{runner: runner})
|
||||||
|
|
||||||
|
err := instance.Rename(s.index, s.message)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -266,6 +266,7 @@ type KeybindingCommitsConfig struct {
|
|||||||
|
|
||||||
type KeybindingStashConfig struct {
|
type KeybindingStashConfig struct {
|
||||||
PopStash string `yaml:"popStash"`
|
PopStash string `yaml:"popStash"`
|
||||||
|
RenameStash string `yaml:"renameStash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingCommitFilesConfig struct {
|
type KeybindingCommitFilesConfig struct {
|
||||||
@ -548,6 +549,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
},
|
},
|
||||||
Stash: KeybindingStashConfig{
|
Stash: KeybindingStashConfig{
|
||||||
PopStash: "g",
|
PopStash: "g",
|
||||||
|
RenameStash: "r",
|
||||||
},
|
},
|
||||||
CommitFiles: KeybindingCommitFilesConfig{
|
CommitFiles: KeybindingCommitFilesConfig{
|
||||||
CheckoutCommitFile: "c",
|
CheckoutCommitFile: "c",
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StashController struct {
|
type StashController struct {
|
||||||
@ -44,6 +45,11 @@ func (self *StashController) GetKeybindings(opts types.KeybindingsOpts) []*types
|
|||||||
Handler: self.checkSelected(self.handleNewBranchOffStashEntry),
|
Handler: self.checkSelected(self.handleNewBranchOffStashEntry),
|
||||||
Description: self.c.Tr.LcNewBranch,
|
Description: self.c.Tr.LcNewBranch,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Key: opts.GetKey(opts.Config.Stash.RenameStash),
|
||||||
|
Handler: self.checkSelected(self.handleRenameStashEntry),
|
||||||
|
Description: self.c.Tr.LcRenameStash,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return bindings
|
return bindings
|
||||||
@ -139,3 +145,27 @@ func (self *StashController) postStashRefresh() error {
|
|||||||
func (self *StashController) handleNewBranchOffStashEntry(stashEntry *models.StashEntry) error {
|
func (self *StashController) handleNewBranchOffStashEntry(stashEntry *models.StashEntry) error {
|
||||||
return self.helpers.Refs.NewBranch(stashEntry.RefName(), stashEntry.Description(), "")
|
return self.helpers.Refs.NewBranch(stashEntry.RefName(), stashEntry.Description(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *StashController) handleRenameStashEntry(stashEntry *models.StashEntry) error {
|
||||||
|
message := utils.ResolvePlaceholderString(
|
||||||
|
self.c.Tr.RenameStashPrompt,
|
||||||
|
map[string]string{
|
||||||
|
"stashName": stashEntry.RefName(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
return self.c.Prompt(types.PromptOpts{
|
||||||
|
Title: message,
|
||||||
|
InitialContent: stashEntry.Name,
|
||||||
|
HandleConfirm: func(response string) error {
|
||||||
|
self.c.LogAction(self.c.Tr.Actions.RenameStash)
|
||||||
|
err := self.git.Stash.Rename(stashEntry.Index, response)
|
||||||
|
_ = self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.STASH}})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
self.context().SetSelectedLineIdx(0) // Select the renamed stash
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -139,6 +139,8 @@ func chineseTranslationSet() TranslationSet {
|
|||||||
SureApplyStashEntry: "您确定要应用此贮藏条目?",
|
SureApplyStashEntry: "您确定要应用此贮藏条目?",
|
||||||
NoTrackedStagedFilesStash: "没有可以贮藏的已跟踪/暂存文件",
|
NoTrackedStagedFilesStash: "没有可以贮藏的已跟踪/暂存文件",
|
||||||
StashChanges: "贮藏更改",
|
StashChanges: "贮藏更改",
|
||||||
|
LcRenameStash: "rename stash",
|
||||||
|
RenameStashPrompt: "Rename stash: {{.stashName}}",
|
||||||
OpenConfig: "打开配置文件",
|
OpenConfig: "打开配置文件",
|
||||||
EditConfig: "编辑配置文件",
|
EditConfig: "编辑配置文件",
|
||||||
ForcePush: "强制推送",
|
ForcePush: "强制推送",
|
||||||
@ -530,6 +532,7 @@ func chineseTranslationSet() TranslationSet {
|
|||||||
UpdateRemote: "更新远程",
|
UpdateRemote: "更新远程",
|
||||||
ApplyPatch: "应用补丁",
|
ApplyPatch: "应用补丁",
|
||||||
Stash: "贮藏 (Stash)",
|
Stash: "贮藏 (Stash)",
|
||||||
|
RenameStash: "Rename stash",
|
||||||
RemoveSubmodule: "删除子模块",
|
RemoveSubmodule: "删除子模块",
|
||||||
ResetSubmodule: "重置子模块",
|
ResetSubmodule: "重置子模块",
|
||||||
AddSubmodule: "添加子模块",
|
AddSubmodule: "添加子模块",
|
||||||
|
@ -105,6 +105,8 @@ func dutchTranslationSet() TranslationSet {
|
|||||||
SureApplyStashEntry: "Weet je zeker dat je deze stash entry wil toepassen?",
|
SureApplyStashEntry: "Weet je zeker dat je deze stash entry wil toepassen?",
|
||||||
NoTrackedStagedFilesStash: "Je hebt geen tracked/staged bestanden om te laten stashen",
|
NoTrackedStagedFilesStash: "Je hebt geen tracked/staged bestanden om te laten stashen",
|
||||||
StashChanges: "Stash veranderingen",
|
StashChanges: "Stash veranderingen",
|
||||||
|
LcRenameStash: "rename stash",
|
||||||
|
RenameStashPrompt: "Rename stash: {{.stashName}}",
|
||||||
NoChangedFiles: "Geen veranderde bestanden",
|
NoChangedFiles: "Geen veranderde bestanden",
|
||||||
OpenConfig: "open config bestand",
|
OpenConfig: "open config bestand",
|
||||||
EditConfig: "verander config bestand",
|
EditConfig: "verander config bestand",
|
||||||
|
@ -128,6 +128,8 @@ type TranslationSet struct {
|
|||||||
NoTrackedStagedFilesStash string
|
NoTrackedStagedFilesStash string
|
||||||
NoFilesToStash string
|
NoFilesToStash string
|
||||||
StashChanges string
|
StashChanges string
|
||||||
|
LcRenameStash string
|
||||||
|
RenameStashPrompt string
|
||||||
OpenConfig string
|
OpenConfig string
|
||||||
EditConfig string
|
EditConfig string
|
||||||
ForcePush string
|
ForcePush string
|
||||||
@ -601,6 +603,7 @@ type Actions struct {
|
|||||||
UpdateRemote string
|
UpdateRemote string
|
||||||
ApplyPatch string
|
ApplyPatch string
|
||||||
Stash string
|
Stash string
|
||||||
|
RenameStash string
|
||||||
RemoveSubmodule string
|
RemoveSubmodule string
|
||||||
ResetSubmodule string
|
ResetSubmodule string
|
||||||
AddSubmodule string
|
AddSubmodule string
|
||||||
@ -769,6 +772,8 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
||||||
NoFilesToStash: "You have no files to stash",
|
NoFilesToStash: "You have no files to stash",
|
||||||
StashChanges: "Stash changes",
|
StashChanges: "Stash changes",
|
||||||
|
LcRenameStash: "rename stash",
|
||||||
|
RenameStashPrompt: "Rename stash: {{.stashName}}",
|
||||||
OpenConfig: "open config file",
|
OpenConfig: "open config file",
|
||||||
EditConfig: "edit config file",
|
EditConfig: "edit config file",
|
||||||
ForcePush: "Force push",
|
ForcePush: "Force push",
|
||||||
@ -1226,6 +1231,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
UpdateRemote: "Update remote",
|
UpdateRemote: "Update remote",
|
||||||
ApplyPatch: "Apply patch",
|
ApplyPatch: "Apply patch",
|
||||||
Stash: "Stash",
|
Stash: "Stash",
|
||||||
|
RenameStash: "Rename stash",
|
||||||
RemoveSubmodule: "Remove submodule",
|
RemoveSubmodule: "Remove submodule",
|
||||||
ResetSubmodule: "Reset submodule",
|
ResetSubmodule: "Reset submodule",
|
||||||
AddSubmodule: "Add submodule",
|
AddSubmodule: "Add submodule",
|
||||||
|
@ -130,6 +130,8 @@ func japaneseTranslationSet() TranslationSet {
|
|||||||
SureApplyStashEntry: "Stashを適用します。よろしいですか?",
|
SureApplyStashEntry: "Stashを適用します。よろしいですか?",
|
||||||
// NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
// NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
||||||
StashChanges: "変更をStash",
|
StashChanges: "変更をStash",
|
||||||
|
LcRenameStash: "Stashを変更",
|
||||||
|
RenameStashPrompt: "Stash名を変更: {{.stashName}}",
|
||||||
OpenConfig: "設定ファイルを開く",
|
OpenConfig: "設定ファイルを開く",
|
||||||
EditConfig: "設定ファイルを編集",
|
EditConfig: "設定ファイルを編集",
|
||||||
ForcePush: "Force push",
|
ForcePush: "Force push",
|
||||||
@ -556,6 +558,7 @@ func japaneseTranslationSet() TranslationSet {
|
|||||||
UpdateRemote: "リモートを更新",
|
UpdateRemote: "リモートを更新",
|
||||||
ApplyPatch: "パッチを適用",
|
ApplyPatch: "パッチを適用",
|
||||||
Stash: "Stash",
|
Stash: "Stash",
|
||||||
|
RenameStash: "Stash名を変更",
|
||||||
RemoveSubmodule: "サブモジュールを削除",
|
RemoveSubmodule: "サブモジュールを削除",
|
||||||
ResetSubmodule: "サブモジュールをリセット",
|
ResetSubmodule: "サブモジュールをリセット",
|
||||||
AddSubmodule: "サブモジュールを追加",
|
AddSubmodule: "サブモジュールを追加",
|
||||||
|
@ -131,6 +131,8 @@ func koreanTranslationSet() TranslationSet {
|
|||||||
SureApplyStashEntry: "정말로 Stash를 적용하시겠습니까?",
|
SureApplyStashEntry: "정말로 Stash를 적용하시겠습니까?",
|
||||||
NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
NoTrackedStagedFilesStash: "You have no tracked/staged files to stash",
|
||||||
StashChanges: "변경을 Stash",
|
StashChanges: "변경을 Stash",
|
||||||
|
LcRenameStash: "rename stash",
|
||||||
|
RenameStashPrompt: "Rename stash: {{.stashName}}",
|
||||||
OpenConfig: "설정 파일 열기",
|
OpenConfig: "설정 파일 열기",
|
||||||
EditConfig: "설정 파일 수정",
|
EditConfig: "설정 파일 수정",
|
||||||
ForcePush: "강제 푸시",
|
ForcePush: "강제 푸시",
|
||||||
@ -561,6 +563,7 @@ func koreanTranslationSet() TranslationSet {
|
|||||||
UpdateRemote: "Update remote",
|
UpdateRemote: "Update remote",
|
||||||
ApplyPatch: "Apply patch",
|
ApplyPatch: "Apply patch",
|
||||||
Stash: "Stash",
|
Stash: "Stash",
|
||||||
|
RenameStash: "Rename stash",
|
||||||
RemoveSubmodule: "서브모듈 삭제",
|
RemoveSubmodule: "서브모듈 삭제",
|
||||||
ResetSubmodule: "서브모듈 Reset",
|
ResetSubmodule: "서브모듈 Reset",
|
||||||
AddSubmodule: "서브모듈 추가",
|
AddSubmodule: "서브모듈 추가",
|
||||||
|
@ -83,6 +83,8 @@ func polishTranslationSet() TranslationSet {
|
|||||||
SureDropStashEntry: "Jesteś pewny, że chcesz porzucić tę pozycję w schowku?",
|
SureDropStashEntry: "Jesteś pewny, że chcesz porzucić tę pozycję w schowku?",
|
||||||
NoTrackedStagedFilesStash: "Nie masz śledzonych/zatwierdzonych plików do przechowania",
|
NoTrackedStagedFilesStash: "Nie masz śledzonych/zatwierdzonych plików do przechowania",
|
||||||
StashChanges: "Przechowaj zmiany",
|
StashChanges: "Przechowaj zmiany",
|
||||||
|
LcRenameStash: "rename stash",
|
||||||
|
RenameStashPrompt: "Rename stash: {{.stashName}}",
|
||||||
OpenConfig: "otwórz konfigurację",
|
OpenConfig: "otwórz konfigurację",
|
||||||
EditConfig: "edytuj konfigurację",
|
EditConfig: "edytuj konfigurację",
|
||||||
ForcePush: "Wymuś wysłanie",
|
ForcePush: "Wymuś wysłanie",
|
||||||
|
@ -111,3 +111,8 @@ func (s *Shell) CreateNCommits(n int) *Shell {
|
|||||||
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Shell) StashWithMessage(message string) *Shell {
|
||||||
|
s.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
37
pkg/integration/tests/stash/rename.go
Normal file
37
pkg/integration/tests/stash/rename.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package stash
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Try to rename the stash.",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.
|
||||||
|
EmptyCommit("blah").
|
||||||
|
CreateFileAndAdd("file-1", "change to stash1").
|
||||||
|
StashWithMessage("foo").
|
||||||
|
CreateFileAndAdd("file-2", "change to stash2").
|
||||||
|
StashWithMessage("bar")
|
||||||
|
},
|
||||||
|
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||||
|
input.SwitchToStashWindow()
|
||||||
|
assert.CurrentViewName("stash")
|
||||||
|
|
||||||
|
assert.MatchSelectedLine(Equals("On master: bar"))
|
||||||
|
input.NextItem()
|
||||||
|
assert.MatchSelectedLine(Equals("On master: foo"))
|
||||||
|
input.PressKeys(keys.Stash.RenameStash)
|
||||||
|
assert.InPrompt()
|
||||||
|
assert.MatchCurrentViewTitle(Equals("Rename stash: stash@{1}"))
|
||||||
|
|
||||||
|
input.Type(" baz")
|
||||||
|
input.Confirm()
|
||||||
|
|
||||||
|
assert.MatchSelectedLine(Equals("On master: foo baz"))
|
||||||
|
},
|
||||||
|
})
|
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
|
||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
|
||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Here is where we lists the actual tests that will run. When you create a new test,
|
// Here is where we lists the actual tests that will run. When you create a new test,
|
||||||
@ -38,6 +39,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
cherry_pick.CherryPick,
|
cherry_pick.CherryPick,
|
||||||
cherry_pick.CherryPickConflicts,
|
cherry_pick.CherryPickConflicts,
|
||||||
custom_commands.FormPrompts,
|
custom_commands.FormPrompts,
|
||||||
|
stash.Rename,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTests() []*components.IntegrationTest {
|
func GetTests() []*components.IntegrationTest {
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
blah
|
@ -0,0 +1 @@
|
|||||||
|
ref: refs/heads/master
|
@ -0,0 +1 @@
|
|||||||
|
209b9fa9264fa15f128127817f080fd7372050cf
|
@ -0,0 +1,12 @@
|
|||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = false
|
||||||
|
logallrefupdates = true
|
||||||
|
ignorecase = true
|
||||||
|
precomposeunicode = true
|
||||||
|
[user]
|
||||||
|
email = CI@example.com
|
||||||
|
name = CI
|
||||||
|
[commit]
|
||||||
|
gpgSign = false
|
@ -0,0 +1 @@
|
|||||||
|
Unnamed repository; edit this file 'description' to name the repository.
|
BIN
test/integration_new/stash/rename/expected/repo/.git_keep/index
Normal file
BIN
test/integration_new/stash/rename/expected/repo/.git_keep/index
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
0000000000000000000000000000000000000000 209b9fa9264fa15f128127817f080fd7372050cf CI <CI@example.com> 1665905121 +0900 commit (initial): blah
|
||||||
|
209b9fa9264fa15f128127817f080fd7372050cf 209b9fa9264fa15f128127817f080fd7372050cf CI <CI@example.com> 1665905122 +0900 reset: moving to HEAD
|
||||||
|
209b9fa9264fa15f128127817f080fd7372050cf 209b9fa9264fa15f128127817f080fd7372050cf CI <CI@example.com> 1665905122 +0900 reset: moving to HEAD
|
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 209b9fa9264fa15f128127817f080fd7372050cf CI <CI@example.com> 1665905121 +0900 commit (initial): blah
|
@ -0,0 +1,2 @@
|
|||||||
|
0000000000000000000000000000000000000000 a5272a200897df5558c8cad683c1af14f7184124 CI <CI@example.com> 1665905122 +0900 On master: bar
|
||||||
|
a5272a200897df5558c8cad683c1af14f7184124 de8f5ed6f8a58664edfbdecd20b75a6ea0633bf6 CI <CI@example.com> 1665905125 +0900 On master: foo baz
|
@ -0,0 +1,3 @@
|
|||||||
|
x�Í1
|
||||||
|
Ã0@ÑÎ>…öB‘]YXPB SŽa9
|
||||||
|
)ĸzüä]?~iµ¾;xzÞúa¤)Ä¥0…¢l*-’®ia )jF‚äò·oí€i†×4�öËõ³Û£´:€gŽ‚ÑwDwÕkÒíOîtÏ›;¢+¸
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
|
|||||||
|
x��Э
|
||||||
|
Т0�=ч)і.Шю&Mzъcф�L[j�>ОёрныЬ|УжRц
|
||||||
|
LњTї�РГ�Rs�й)ЄЇЬ6ЈEVВVдs�лгв@Доfg[�u�И'6=��=цhЄaь0dсоuZwFИ
у#ЎlЯt kЙiнYќоТ-Ђhi�ЊщЯЙ���X(юеЈыЯ
|
||||||
|
ќгMтrЯ@%
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
x��½j1„]ßS¨˜ýѯ1ÁpÕU~i¥%Ëg.gÈã[.Ò§�ùfvGÖÞ¿wC6ö5Sˆ+{ª¬Ùá‚JIlÅbbòÉôÈ[»� ¤’4§ahF§H)D
|
||||||
|
´Dÿxï*¢Ä2.Ž”9x�’ŠŽ’
|
||||||
|
¼(Nù¹›™sž—KûÍýqkGYû§Aï]‚÷æÀ4Ô1boÿħëÝôü3ø“)y{¬OHW
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
x�ϱj1ÐÔ÷êfµ’v%LÀ•+Þ´K‘e.gÈçG�{·Ã›�©£÷ïÝaÌoû¦ê2eá’™“ß(d¶�¼´F5Éj@µ!$^î²ém¡¬Å¤ EŸÌcöÈÙ³Ak!Aµ§�A¢ND±ªúÆ€ Ô™Ñ`Õcù/�ýklî|qç˧þI¿ÿ衎~rž(HѽCXf:Oìú"_®7×åwú£³1þqHë
|
@ -0,0 +1 @@
|
|||||||
|
209b9fa9264fa15f128127817f080fd7372050cf
|
@ -0,0 +1 @@
|
|||||||
|
de8f5ed6f8a58664edfbdecd20b75a6ea0633bf6
|
Loading…
x
Reference in New Issue
Block a user