MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / watch_repository

Function watch_repository

atomic-cli/build.rs:24–44  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

22}
23
24fn watch_repository(root: &Path) {
25 // --git-path resolves shared refs and worktree-local HEAD/index correctly.
26 // Watch loose refs as well as packed refs: an empty commit need not change
27 // any source file, and updating a packed branch can create a new loose ref.
28 for name in ["HEAD", "index", "packed-refs", "refs/heads"] {
29 if let Some(path) = git(root, &["rev-parse", "--git-path", name]) {
30 let path = root.join(path.trim());
31 if path.exists() {
32 println!("cargo:rerun-if-changed={}", path.display());
33 }
34 }
35 }
36
37 // Track unstaged edits too, including workspace files outside atomic-cli.
38 // Watching only the index would leave a cached dirty marker stale.
39 if let Some(files) = git(root, &["ls-files", "-z"]) {
40 for file in files.split('\0').filter(|file| !file.is_empty()) {
41 println!("cargo:rerun-if-changed={}", root.join(file).display());
42 }
43 }
44}
45
46fn main() {
47 // libgit2 1.8 (libgit2-sys 0.17.0+1.8.1) references Advapi32 symbols

Callers 1

mainFunction · 0.85

Calls 3

gitFunction · 0.70
existsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected