fix(compiler): broken .git
dir path resolution
#269
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.
Currently, in the file
lua/github-theme/init.lua
, the codeutil.join_paths(debug.getinfo(1).source:sub(2, -23), '.git')
returns an absolute path ending in**/lua/.git
which is not, and will never be, a valid path to the.git
directory. This means that recompilation does not currently occur when the plugin updates or changes (unless user config changes too) and that users may miss crucial updates (e.g. bug fixes).Fix bug by changing
util.join_paths(debug.getinfo(1).source:sub(2, -23), '.git')
todebug.getinfo(1).source .. '/../../../.git'
, and then use luv's/libuv'sfs_stat()
to get the last modified time of this path. This change does not rely on any particular filenames existing in the path, but it still relies on a hard-coded depth. If the path does not exist or the stat is unsuccessful, force recompilation (as otherwise plugin updates could be missed by many users).Use libuv/luv
fs_stat()
to get.git
dir's mtime with nanosecond precision (NOTE: this function is only available by default in Neovim, not Vim, however, it appears that this plugin isn't compatible with Vim currently anyway, so this shouldn't be an issue).Correctly handle
.git
files, as.git
is not always a directory.See #262