fix: avoid passing .git directories to on-load (#2382)
* fix: avoid passing `.git` directories to `on-load` * docs: update `CHANGELOG.md`
This commit is contained in:
1 parent
3a0b538d8b
commit
4b8281ea86
2 files changed
+11
-4
No files matched your search
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
- Previews are now correctly updated on `visual-change` (#2373).
|
||||
- The `dircounts` indicator for errors is changed back to `!` instead of `?` (#2372).
|
||||
- The `select` command can now select files immediately after creation as part of a script (#2377).
|
||||
- The `on-load` hook command now ignores `.git` directories by default to avoid flicker and repeated `on-load` triggers.
|
||||
|
||||
## [r41](https://github.com/gokcehan/lf/releases/tag/r41)
|
||||
|
||||
|
||||
@@ -414,11 +414,17 @@ func (app *app) loop() {
|
||||
|
||||
app.watchDir(d)
|
||||
|
||||
paths := []string{}
|
||||
for _, file := range d.allFiles {
|
||||
paths = append(paths, file.path)
|
||||
// Avoid flickering UI and multiple, unnecessary `on-load` calls
|
||||
// triggered by Git commands executed inside the users `on-load`
|
||||
// command (often used to add git symbols using `addcustominfo`).
|
||||
// TODO: Should `watch` also ignore `.git` directories?
|
||||
if filepath.Base(d.path) != ".git" {
|
||||
paths := make([]string, len(d.allFiles))
|
||||
for i, file := range d.allFiles {
|
||||
paths[i] = file.path
|
||||
}
|
||||
onLoad(app, paths)
|
||||
}
|
||||
onLoad(app, paths)
|
||||
|
||||
if d.path == app.nav.currDir().path {
|
||||
app.nav.preload()
|
||||
|
||||
Reference in new issue
Block a user