Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: throws error if dir not found #3419

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sahil9001
Copy link
Contributor

Description:

This PR relates to #3005 . If the directory is not found, the process returns an error message and exits.

Screenshot 2024-10-16 at 1 42 58 AM

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@sahil9001 sahil9001 requested review from a team as code owners October 15, 2024 20:13
Comment on lines +331 to +334
// Check if the directory exists
if _, err := os.Stat(gitDir); os.IsNotExist(err) {
return fmt.Errorf("directory does not exist: %s", gitDir)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change is the only one that's needed. With just it applied, this is the output I get:

trufflehog (remotes/origin/HEAD *) % ./trufflehog git file:///oops
🐷🔑🐷  TruffleHog. Unearth your secrets. 🐷🔑🐷

2024-10-16T16:14:08-04:00	info-0	trufflehog	running source	{"source_manager_worker_id": "hN9fy", "with_units": true}
2024-10-16T16:14:08-04:00	error	trufflehog	error running scan	{"error": "engine failed to finish execution: fatal: directory does not exist: /oops"}
trufflehog (remotes/origin/HEAD *) % echo $?
1

Are you seeing something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants