From 6188ee1886a8bb03c18a16b2464f4dcbdf5a018c Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 12 Oct 2024 22:24:40 +0200 Subject: [PATCH] fix wrong -dirty prefix in version (#3869) --- internal/core/versiongetter/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/core/versiongetter/main.go b/internal/core/versiongetter/main.go index 016ef310..80f76d37 100644 --- a/internal/core/versiongetter/main.go +++ b/internal/core/versiongetter/main.go @@ -76,11 +76,12 @@ func tagFromGit() error { // where .git/objects/info/alternates points to a directory outside of the .git directory. // // To work around this, specify an AlternatesFS that allows access to the entire filesystem. - fs := osfs.New("../../.git", osfs.WithBoundOS()) - storer := filesystem.NewStorageWithOptions(fs, cache.NewObjectLRUDefault(), filesystem.Options{ + storerFs := osfs.New("../../.git", osfs.WithBoundOS()) + storer := filesystem.NewStorageWithOptions(storerFs, cache.NewObjectLRUDefault(), filesystem.Options{ AlternatesFS: osfs.New("/", osfs.WithBoundOS()), }) - repo, err := git.Open(storer, fs) + worktreeFs := osfs.New("../..", osfs.WithBoundOS()) + repo, err := git.Open(storer, worktreeFs) if err != nil { return fmt.Errorf("failed to open repository: %w", err) }