Commit graph

3 commits

Author SHA1 Message Date
Andrew Nesbitt
12ab1b37ac
pkg/gitinterface: remove os.Chdir; set cmd.Dir on the executor instead
LoadRepository did os.Chdir(repositoryPath) to run 'git rev-parse
--git-dir', and Status/RestoreWorktree/tree-restore did the same to run
worktree-relative commands. os.Chdir is process-global; concurrent
LoadRepository calls for different paths could each resolve the wrong
gitDirPath.

Adds executor.withDir(dir) which sets cmd.Dir. LoadRepository now runs
'git rev-parse --absolute-git-dir' with cmd.Dir set to the repository
path (and EvalSymlinks the result to match prior behaviour). The
worktree commands use withDir(worktree).

TestLoadRepositoryConcurrent runs 20 pairs of LoadRepository for two
distinct repos in parallel under -race and asserts each gets its own
gitDirPath.

Signed-off-by: Andrew Nesbitt <andrewnez@gmail.com>
2026-06-29 17:13:31 +01:00
Pat Zielinski
1f8cf912cc
pkg: Drop support for Git versions older than v2.38.0
Signed-off-by: Pat Zielinski <git@patzielinski.com>
2026-06-10 09:56:56 -04:00
Pat Zielinski
f649b141d3
pkg: Move gitinterface to pkg
Signed-off-by: Pat Zielinski <git@patzielinski.com>
2026-01-16 14:03:36 -05:00
Renamed from internal/gitinterface/utils.go (Browse further)