Files
w3cjandClaude Opus 5.5 cda2d09f42 feat(gitprotect): on Linux, warn at each launch and report .git hooks and config that changed (#20)
Linux hosts have no unprivileged immutable flag, so devvm can't lock
.git there. It now warns at every launch of a VM that mounts a folder
with a .git (git_unprotected), unless it's a --clone VM or the user
chose devvm git-protect off (git.chosen), and it names, after the fact,
the hooks and config that changed (git_changed). It sums what a lock
would cover, .git/commondir, include.path targets and the folder
core.hooksPath names, never through a symlink out of the project folder
and within bounds (git_watch_blind names what it can't fully watch), at
each launch that finds the VM stopped and at devvm stop.

A check on such a host runs protect's reports without locking:
git_replaced, git_commondir, stray worktrees, git dirs that appeared,
core.hooksPath and delegations into the project folder, and a
submodule's folder that isn't a git dir (git_gitdir_not_git), in which
nothing is created and which the watch doesn't sum as a git dir.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:16:30 -07:00

20 lines
468 B
Go

package platform
import (
"io/fs"
"strconv"
"syscall"
)
// ChangeID is a file's inode and change time, "ino I ctime S.N", which
// any change to the file moves and nobody but the kernel sets: "" when fi
// has none.
func ChangeID(fi fs.FileInfo) string {
st, ok := fi.Sys().(*syscall.Stat_t)
if !ok {
return ""
}
return "ino " + strconv.FormatUint(st.Ino, 10) + " ctime " +
strconv.FormatInt(st.Ctim.Sec, 10) + "." + strconv.FormatInt(st.Ctim.Nsec, 10)
}