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

Function dispatcher_script

atomic-cli/src/commands/git/hooks.rs:301–314  ·  view source on GitHub ↗
(binary: &Path, subcommand: &str)

Source from the content-addressed store, hash-verified

299}
300
301fn dispatcher_script(binary: &Path, subcommand: &str) -> io::Result<String> {
302 let binary = shell_quote(binary)?;
303 Ok(format!(
304 "#!/bin/sh\n{DISPATCHER_MARKER}\n\
305{binary} git shim {subcommand} \"$@\" || true\n\
306if [ -d \"$0.d\" ]; then\n\
307 for atomic_shim_hook in \"$0.d\"/*; do\n\
308 [ -f \"$atomic_shim_hook\" ] && [ -x \"$atomic_shim_hook\" ] || continue\n\
309 \"$atomic_shim_hook\" \"$@\" || true\n\
310 done\n\
311fi\n\
312exit 0\n"
313 ))
314}
315
316/// Script for the stdin-reading advisory dispatchers (`post-rewrite`,
317/// `reference-transaction`). Stdin is forwarded so Git's evidence lines

Calls 1

shell_quoteFunction · 0.70