mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Add integration test for remote branch sort order
This commit is contained in:
parent
3fe491fcb2
commit
1e3935cbaf
3 changed files with 74 additions and 2 deletions
|
@ -31,7 +31,11 @@ func NewShell(dir string, fail func(string)) *Shell {
|
|||
}
|
||||
|
||||
func (self *Shell) RunCommand(args []string) *Shell {
|
||||
output, err := self.runCommandWithOutput(args)
|
||||
return self.RunCommandWithEnv(args, []string{})
|
||||
}
|
||||
|
||||
func (self *Shell) RunCommandWithEnv(args []string, env []string) *Shell {
|
||||
output, err := self.runCommandWithOutputAndEnv(args, env)
|
||||
if err != nil {
|
||||
self.fail(fmt.Sprintf("error running command: %v\n%s", args, output))
|
||||
}
|
||||
|
@ -49,8 +53,12 @@ func (self *Shell) RunCommandExpectError(args []string) *Shell {
|
|||
}
|
||||
|
||||
func (self *Shell) runCommandWithOutput(args []string) (string, error) {
|
||||
return self.runCommandWithOutputAndEnv(args, []string{})
|
||||
}
|
||||
|
||||
func (self *Shell) runCommandWithOutputAndEnv(args []string, env []string) (string, error) {
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(os.Environ(), env...)
|
||||
cmd.Dir = self.dir
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
|
@ -164,6 +172,14 @@ func (self *Shell) EmptyCommitDaysAgo(message string, daysAgo int) *Shell {
|
|||
return self.RunCommand([]string{"git", "commit", "--allow-empty", "--date", fmt.Sprintf("%d days ago", daysAgo), "-m", message})
|
||||
}
|
||||
|
||||
func (self *Shell) EmptyCommitWithDate(message string, date string) *Shell {
|
||||
env := []string{
|
||||
"GIT_AUTHOR_DATE=" + date,
|
||||
"GIT_COMMITTER_DATE=" + date,
|
||||
}
|
||||
return self.RunCommandWithEnv([]string{"git", "commit", "--allow-empty", "-m", message}, env)
|
||||
}
|
||||
|
||||
func (self *Shell) Revert(ref string) *Shell {
|
||||
return self.RunCommand([]string{"git", "revert", ref})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue