cli: disallow pushing open commit

This commit is contained in:
Martin von Zweigbergk 2021-04-15 06:51:06 -07:00
parent 4c3d73ff3b
commit 209c62075e

View file

@ -2118,6 +2118,11 @@ fn cmd_git_push(
let repo = get_repo(ui, &matches)?;
let git_repo = get_git_repo(repo.store())?;
let (repo, commit) = resolve_revision_arg(ui, repo, cmd_matches)?;
if commit.is_open() {
return Err(CommandError::UserError(
"Won't push open commit".to_string(),
));
}
let remote_name = cmd_matches.value_of("remote").unwrap();
let branch_name = cmd_matches.value_of("branch").unwrap();
git::push_commit(&git_repo, &commit, remote_name, branch_name)