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:2011–2027  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2009 #[cfg(unix)]
2010 #[test]
2011 fn symlink_hook_is_never_replaced() {
2012 use std::os::unix::fs::symlink;
2013
2014 let root = TempDir::new().unwrap();
2015 let target = root.path().join("target");
2016 let hook = root.path().join("post-checkout");
2017 fs::write(&target, b"custom target\n").unwrap();
2018 symlink(&target, &hook).unwrap();
2019
2020 let result = install_or_refresh_dispatcher(&hook, "owned").unwrap();
2021 assert_eq!(result, DispatcherInstall::Unmanaged);
2022 assert_eq!(fs::read(&target).unwrap(), b"custom target\n");
2023 assert!(fs::symlink_metadata(&hook)
2024 .unwrap()
2025 .file_type()
2026 .is_symlink());
2027 }
2028
2029 /// CB-8B ac-4: a deferred observation request is consumed exactly once.
2030 /// 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