1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Move current worktree to top of list

This commit is contained in:
Jesse Duffield
2023-07-16 14:23:31 +10:00
parent 077ae99438
commit 53f4ccb809
2 changed files with 32 additions and 7 deletions

View File

@ -33,12 +33,16 @@ func (self *WorktreeCommands) Delete(worktreePath string, force bool) error {
}
func (self *WorktreeCommands) IsCurrentWorktree(w *models.Worktree) bool {
return IsCurrentWorktree(w)
}
func IsCurrentWorktree(w *models.Worktree) bool {
pwd, err := os.Getwd()
if err != nil {
log.Fatalln(err.Error())
}
return pwd == w.Path
return EqualPath(pwd, w.Path)
}
func (self *WorktreeCommands) IsWorktreePathMissing(w *models.Worktree) bool {
@ -50,3 +54,9 @@ func (self *WorktreeCommands) IsWorktreePathMissing(w *models.Worktree) bool {
}
return false
}
// checks if two paths are equal
// TODO: support relative paths
func EqualPath(a string, b string) bool {
return a == b
}