git: import refs after pushing to git remote

This makes it so `jj git push` effectively runs `jj git refresh` after
pushing. That's useful so the user sees the updated remote-tracking
branch.
This commit is contained in:
Martin von Zweigbergk 2021-01-10 23:23:40 -08:00
parent 19b542b318
commit f4a6732d35

View file

@ -2080,6 +2080,9 @@ fn cmd_git_push(
let branch_name = cmd_matches.value_of("branch").unwrap();
git::push_commit(&git_repo, &commit, remote_name, branch_name)
.map_err(|err| CommandError::UserError(err.to_string()))?;
let mut tx = repo.start_transaction("import git refs");
git::import_refs(&mut tx, &git_repo).map_err(|err| CommandError::UserError(err.to_string()))?;
tx.commit();
Ok(())
}