Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 21, 2026

Description

This PR fixes a bug where run_index fails if the database path resides in a non-existent directory. The fix ensures that the parent directory of the database path is created before attempting to open the database connection.

Changes

  • In src/cli/commands.rs: Added logic to check and create the parent directory of the database path if it does not exist.

Reproduction

  1. Configure vgrep with a db_path in a non-existent directory.
  2. Run vgrep index.
  3. Before fix: SQLite error about being unable to open database.
  4. After fix: Directory is created and indexing proceeds.

Verification

  • Added a reproduction test case (verified locally) that confirms the directory is created and database initialization succeeds.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants