Skip to main content

commit_branch_and_push

Function commit_branch_and_push 

Source
pub fn commit_branch_and_push(
    root: &Path,
    branch: &str,
    message: &str,
    token: &str,
    github: &Repo,
    paths: &[PathBuf],
) -> Result<PushOutcome>
Expand description

Commits paths onto branch without moving HEAD, then force-pushes branch to github over HTTPS with token.

When paths leave the tree unchanged, nothing is pushed and the result is PushOutcome::Empty.

ยงErrors

Returns an error when:

  • root is not inside a git repository;
  • the repository has no workdir, or HEAD names no commit;
  • a path lies outside the workdir, is not UTF-8, or cannot be read or filtered;
  • the commit or branch ref cannot be written;
  • git push fails or runs past five minutes.