Skip to content

Commit 43b4b2f

Browse files
committed
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.
1 parent b741bb8 commit 43b4b2f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/remote.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,10 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
264264
if ((error = add_refspec(remote, fetch, true)) < 0)
265265
goto on_error;
266266

267-
/* only write for non-anonymous remotes */
268-
if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
269-
goto on_error;
270-
271-
if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
267+
/* only write for named remotes with a repository */
268+
if (repo && name &&
269+
((error = write_add_refspec(repo, name, fetch, true)) < 0 ||
270+
(error = lookup_remote_prune_config(remote, config_ro, name)) < 0))
272271
goto on_error;
273272

274273
/* Move the data over to where the matching functions can find them */

0 commit comments

Comments
 (0)