Skip to content

Pre-empt latent Windows path-mismatch in update_index()#48

Merged
TroyHernandez merged 1 commit into
mainfrom
fix/update-index-windows-dirname
May 19, 2026
Merged

Pre-empt latent Windows path-mismatch in update_index()#48
TroyHernandez merged 1 commit into
mainfrom
fix/update-index-windows-dirname

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Same buggy pattern as the vault_graph() fix in 0.6.3 (dirname(file) != normalizePath(vault) is always TRUE on Windows). Currently inert because update_index()'s category-prefix emission loop drops control files anyway, but the buggy pattern is a footgun if that downstream filter is ever refactored. winslash = '/' fixes it the same way as vault_graph(). No version bump — 0.6.3 isn't on CRAN yet.

R/index.R:28-29 uses the same `dirname(file) != vault` filter that
vault_graph() did. On Windows normalizePath() returns backslashes
while dirname() returns forward slashes, so the comparison is always
false and control files leak into the post-filter all_md.

This is currently inert because update_index()'s downstream emission
loop iterates over `categories` and only outputs files whose path
starts with one of wiki/, raw/articles/, raw/chats/, ..., so control
files at the vault root never appear in index.md. test_index.R's
"no [[index]] / [[log]] / [[schema]]" assertions pass for the same
reason. If anyone later refactors the category-prefix filter the
bug becomes live.

Normalise `vault` with winslash = "/" to match dirname()'s output on
both platforms. Same fix shape as vault_graph() in 0.6.3.

No version bump: 0.6.3 isn't on CRAN yet; this rides under the same
submission.
@TroyHernandez TroyHernandez merged commit 6103312 into main May 19, 2026
2 checks passed
@TroyHernandez TroyHernandez deleted the fix/update-index-windows-dirname branch May 19, 2026 06:39
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.

1 participant