mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-09 10:54:59 +01:00
wip: watch select .git files in watcher
This commit is contained in:
@@ -9,7 +9,6 @@ import { Installation } from "../../installation"
|
||||
import { Config } from "../../config/config"
|
||||
import { Bus } from "../../bus"
|
||||
import { Log } from "../../util/log"
|
||||
import { FileWatcher } from "../../file/watcher"
|
||||
import { Ide } from "../../ide"
|
||||
|
||||
import { Flag } from "../../flag/flag"
|
||||
@@ -178,7 +177,6 @@ export const TuiCommand = cmd({
|
||||
.then(() => Bus.publish(Ide.Event.Installed, { ide }))
|
||||
.catch(() => {})
|
||||
})()
|
||||
FileWatcher.init()
|
||||
|
||||
await proc.exited
|
||||
server.stop()
|
||||
|
||||
@@ -6,9 +6,6 @@ export namespace FileIgnore {
|
||||
"**/.pnpm-store/**",
|
||||
"**/vendor/**",
|
||||
|
||||
// vcs
|
||||
"**/.git/**",
|
||||
|
||||
// Build outputs
|
||||
"**/dist/**",
|
||||
"**/build/**",
|
||||
@@ -50,8 +47,12 @@ export namespace FileIgnore {
|
||||
filepath: string,
|
||||
opts: {
|
||||
extra?: Bun.Glob[]
|
||||
whitelist?: Bun.Glob[]
|
||||
},
|
||||
) {
|
||||
for (const glob of opts.whitelist || []) {
|
||||
if (glob.match(filepath)) return false
|
||||
}
|
||||
const extra = opts.extra || []
|
||||
for (const glob of [...GLOBS, ...extra]) {
|
||||
if (glob.match(filepath)) return true
|
||||
|
||||
@@ -30,6 +30,7 @@ export namespace FileWatcher {
|
||||
ignoreInitial: true,
|
||||
ignored: (filepath) => {
|
||||
return FileIgnore.match(filepath, {
|
||||
whitelist: [new Bun.Glob("**/.git/{index,logs/HEAD}")],
|
||||
extra: ignore,
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user