Skip to content

Commit

Permalink
(WIP) non temp dir
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya Sirish <aditya@saky.in>
  • Loading branch information
adityasaky committed May 25, 2024
1 parent 0f3bcc0 commit 1b330e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/gitinterface/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package gitinterface
import (
"bytes"
"context"
"os"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -35,8 +36,8 @@ var (
)

func TestRepositoryCommit(t *testing.T) {
tempDir := t.TempDir()
repo := CreateTestGitRepository(t, tempDir)
os.Mkdir("gittuf-test", 0o775)

Check failure on line 39 in internal/gitinterface/commit_test.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `os.Mkdir` is not checked (errcheck)
repo := CreateTestGitRepository(t, "gittuf-test")

refName := "refs/heads/main"
treeBuilder := NewReplacementTreeBuilder(repo)
Expand Down
8 changes: 7 additions & 1 deletion internal/gitinterface/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ var (
func CreateTestGitRepository(t *testing.T, dir string) *Repository {
t.Helper()

keysDir := t.TempDir()
var keysDir string
if dir == "gittuf-test" {
dir = dir + "/repo"

Check failure on line 45 in internal/gitinterface/common.go

View workflow job for this annotation

GitHub Actions / lint

assignOp: replace `dir = dir + "/repo"` with `dir += "/repo"` (gocritic)
keysDir = dir + "/keys"
} else {
keysDir = t.TempDir()
}

setupSigningKeys(t, keysDir)

Expand Down

0 comments on commit 1b330e4

Please sign in to comment.