Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): broken
.git
dir path resolution
Currently, in the file `lua/github-theme/init.lua`, the code `util.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). 1. Fix bug by changing `util.join_paths(debug.getinfo(1).source:sub(2, -23), '.git')` to `debug.getinfo(1).source .. '/../../../.git'`, and then use luv's/libuv's `fs_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). 2. 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). 3. Correctly handle `.git` files, as `.git` is not always a directory. See #262
- Loading branch information