From 3d9f1e02e5063e1ce24f4b9122963eaef64b7262 Mon Sep 17 00:00:00 2001 From: John Whitley Date: Sun, 24 Dec 2023 08:46:02 -0800 Subject: Refactor repo_paths.go to use git rev-parse This changes GetRepoPaths() to pull information from `git rev-parse` instead of effectively reimplementing git's logic for pathfinding. This change fixes issues with bare repos, esp. versioned homedir use cases, by aligning lazygit's path handling to what git itself does. This change also enables lazygit to run from arbitrary subdirectories of a repository, including correct handling of symlinks, including "deep" symlinks into a repo, worktree, a repo's submodules, etc. Integration tests are now resilient against unintended side effects from the host's environment variables. Of necessity, $PATH and $TERM are the only env vars allowed through now. --- pkg/commands/git_commands/stash.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/commands/git_commands/stash.go') diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index fad73a472..29140e68e 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -88,6 +88,7 @@ func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj { Arg(fmt.Sprintf("--unified=%d", self.AppState.DiffContextSize)). ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space"). Arg(fmt.Sprintf("stash@{%d}", index)). + Dir(self.repoPaths.worktreePath). ToArgv() return self.cmd.New(cmdArgs).DontLog() -- cgit v1.2.3