mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-02 18:01:05 +00:00
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,
|
||||
) -> Result<(), CommandError> {
|
||||
let mut workspace_command = command.workspace_helper(ui)?;
|
||||
let remote = args
|
||||
.remote
|
||||
.clone()
|
||||
.unwrap_or_else(|| command.settings().config().get("git.fetch").unwrap());
|
||||
let remote = if let Some(name) = &args.remote {
|
||||
name.clone()
|
||||
} else {
|
||||
command.settings().config().get("git.fetch")?
|
||||
};
|
||||
let repo = workspace_command.repo();
|
||||
let git_repo = get_git_repo(repo.store())?;
|
||||
let mut tx = workspace_command.start_transaction(&format!("fetch from git remote {}", &remote));
|
||||
|
@ -4158,10 +4159,11 @@ fn cmd_git_push(
|
|||
args: &GitPushArgs,
|
||||
) -> Result<(), CommandError> {
|
||||
let mut workspace_command = command.workspace_helper(ui)?;
|
||||
let remote = args
|
||||
.remote
|
||||
.clone()
|
||||
.unwrap_or_else(|| command.settings().config().get("git.push").unwrap());
|
||||
let remote = if let Some(name) = &args.remote {
|
||||
name.clone()
|
||||
} else {
|
||||
command.settings().config().get("git.push")?
|
||||
};
|
||||
let mut tx;
|
||||
let mut branch_updates = vec![];
|
||||
let mut seen_branches = hashset! {};
|
||||
|
|
Loading…
Reference in a new issue