Pre-empt latent Windows path-mismatch in update_index()#48
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.