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

Function symlink_hook_is_never_replaced

atomic-cli/src/commands/git/hooks.rs:1980–1996  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1978 #[cfg(unix)]
1979 #[test]
1980 fn symlink_hook_is_never_replaced() {
1981 use std::os::unix::fs::symlink;
1982
1983 let root = TempDir::new().unwrap();
1984 let target = root.path().join("target");
1985 let hook = root.path().join("post-checkout");
1986 fs::write(&target, b"custom target\n").unwrap();
1987 symlink(&target, &hook).unwrap();
1988
1989 let result = install_or_refresh_dispatcher(&hook, "owned").unwrap();
1990 assert_eq!(result, DispatcherInstall::Unmanaged);
1991 assert_eq!(fs::read(&target).unwrap(), b"custom target\n");
1992 assert!(fs::symlink_metadata(&hook)
1993 .unwrap()
1994 .file_type()
1995 .is_symlink());
1996 }
1997
1998 /// CB-8B ac-4: a deferred observation request is consumed exactly once.
1999 /// A duplicate run (the event duplicated between prepare and consume) is

Callers

nothing calls this directly

Calls 4

writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected