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.
diff --git a/src/remote.c b/src/remote.c
index 96f501f..3cead71 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -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)
goto on_error;
- /* only write for non-anonymous remotes */
- if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
- goto on_error;
-
- if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
+ /* only write for named remotes with a repository */
+ if (repo && name &&
+ ((error = write_add_refspec(repo, name, fetch, true)) < 0 ||
+ (error = lookup_remote_prune_config(remote, config_ro, name)) < 0))
goto on_error;
/* Move the data over to where the matching functions can find them */