forked from mirrors/jj
cli: fix panic on invalid git.fetch/push config value
The default could be overridden by invalid value.
This commit is contained in:
parent
5d0535276c
commit
57c554b75c
1 changed files with 10 additions and 8 deletions
|
@ -3901,10 +3901,11 @@ fn cmd_git_fetch(
|
||||||
args: &GitFetchArgs,
|
args: &GitFetchArgs,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let mut workspace_command = command.workspace_helper(ui)?;
|
||||||
let remote = args
|
let remote = if let Some(name) = &args.remote {
|
||||||
.remote
|
name.clone()
|
||||||
.clone()
|
} else {
|
||||||
.unwrap_or_else(|| command.settings().config().get("git.fetch").unwrap());
|
command.settings().config().get("git.fetch")?
|
||||||
|
};
|
||||||
let repo = workspace_command.repo();
|
let repo = workspace_command.repo();
|
||||||
let git_repo = get_git_repo(repo.store())?;
|
let git_repo = get_git_repo(repo.store())?;
|
||||||
let mut tx = workspace_command.start_transaction(&format!("fetch from git remote {}", &remote));
|
let mut tx = workspace_command.start_transaction(&format!("fetch from git remote {}", &remote));
|
||||||
|
@ -4158,10 +4159,11 @@ fn cmd_git_push(
|
||||||
args: &GitPushArgs,
|
args: &GitPushArgs,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let mut workspace_command = command.workspace_helper(ui)?;
|
||||||
let remote = args
|
let remote = if let Some(name) = &args.remote {
|
||||||
.remote
|
name.clone()
|
||||||
.clone()
|
} else {
|
||||||
.unwrap_or_else(|| command.settings().config().get("git.push").unwrap());
|
command.settings().config().get("git.push")?
|
||||||
|
};
|
||||||
let mut tx;
|
let mut tx;
|
||||||
let mut branch_updates = vec![];
|
let mut branch_updates = vec![];
|
||||||
let mut seen_branches = hashset! {};
|
let mut seen_branches = hashset! {};
|
||||||
|
|
Loading…
Reference in a new issue