-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(compiler): broken .git
dir path resolution
#269
base: main
Are you sure you want to change the base?
Conversation
715c93a
to
7070071
Compare
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 projekt0n#262
7070071
to
ec07bf9
Compare
2023-05-30.11-31-57.mp4
|
Yes, it doesn't appear to be working, there is a bug somewhere.
Ok. To be fair, we're talking about a difference of
How? Does git |
I should probably close this, this has all been fixed for the most part.
|
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