Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: git worktree was not supported #813

Merged
merged 3 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cmd/terramate/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1756,18 +1756,13 @@ func lookupProject(wd string) (prj project, found bool, err error) {
gitabs = filepath.Join(wd, gitdir)
}

if err != nil {
return project{}, false, errors.E(err, "getting absolute path of %q", gitdir)
}

logger.Trace().Msg("Evaluate symbolic links.")

gitabs, err = filepath.EvalSymlinks(gitabs)
rootdir, err := filepath.EvalSymlinks(gitabs)
if err != nil {
return project{}, false, errors.E(err, "failed evaluating symlinks of %q", gitabs)
}

rootdir := filepath.Dir(gitabs)
if rootfound && strings.HasPrefix(rootCfgPath, rootdir) && rootCfgPath != rootdir {
log.Warn().
Str("rootConfig", rootCfgPath).
Expand Down
2 changes: 1 addition & 1 deletion git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ func (git *Git) ListUncommitted(dirs ...string) ([]string, error) {

// Root returns the git root directory.
func (git *Git) Root() (string, error) {
return git.exec("rev-parse", "--git-dir")
return git.exec("rev-parse", "--show-toplevel")
}

// IsRepository tell if the git wrapper setup is operating in a valid git
Expand Down