Commit 43b4b2fa by Etienne Samson

remote: merge if-statements

We need a repo/config and a name to be able to do anything to the configuration. As such, those two tests can be merged so their conditions are shared.
parent b741bb89
...@@ -264,11 +264,10 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n ...@@ -264,11 +264,10 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
if ((error = add_refspec(remote, fetch, true)) < 0) if ((error = add_refspec(remote, fetch, true)) < 0)
goto on_error; goto on_error;
/* only write for non-anonymous remotes */ /* only write for named remotes with a repository */
if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0) if (repo && name &&
goto on_error; ((error = write_add_refspec(repo, name, fetch, true)) < 0 ||
(error = lookup_remote_prune_config(remote, config_ro, name)) < 0))
if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
goto on_error; goto on_error;
/* Move the data over to where the matching functions can find them */ /* Move the data over to where the matching functions can find them */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment