Skip to content

Commit

Permalink
Update dot_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
picatz committed Jan 12, 2024
1 parent 0072e64 commit e1d3cc7
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions callgraphutil/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,9 @@ func cloneGitHubRepository(ctx context.Context, ownerName, repoName string) (str
ownerAndRepo := ownerName + "/" + repoName

// Get the directory path.
dir := filepath.Join(os.TempDir(), "taint", "github", ownerAndRepo)

// Check if the directory exists.
_, err := os.Stat(dir)
if err == nil {
// If the directory exists, we'll assume it's a valid repository,
// and return the directory. Open the directory to
repo, err := git.PlainOpen(dir)
if err != nil {
return dir, "", fmt.Errorf("%w", err)
}

// Get the repository's HEAD.
head, err := repo.Head()
if err != nil {
return dir, "", fmt.Errorf("%w", err)
}

return dir, head.Hash().String(), nil
dir, err := os.MkdirTemp(filepath.Join(os.TempDir(), "callgraphutil_csv"), fmt.Sprintf("%s-%s", ownerName, repoName))
if err != nil {
return "", "", fmt.Errorf("failed to create temp dir: %w", err)
}

// Clone the repository.
Expand Down

0 comments on commit e1d3cc7

Please sign in to comment.