pub fn publish_dir(
repo_url: &str,
branch: &str,
subdir: &str,
src_dir: &Path,
message: &str,
work_dir: &Path,
) -> Result<()>Expand description
Publish the contents of src_dir into repo_url on branch, under subdir, as a single
commit, then push. work_dir is a caller-owned empty scratch directory used as the clone
working tree.
Reuses the exact same SSRF validation, host-allowlist, per-host credential injection, and
network-hardening (http.followRedirects=false, low-speed abort) as clone_or_fetch, so
it is safe to point at a corporate host over a VPN or at an air-gapped local mirror (the
latter behind SLOC_GIT_ALLOW_LOCAL / SLOC_GIT_LOCAL_ROOT). Appends to the branch’s
existing history when it exists, creates it (even from an empty repo’s unborn HEAD)
otherwise. Returns Ok(()) without pushing when nothing changed since the last publish.
§Errors
Propagates clone/commit/push failures and URL-validation / local-gate rejections.