]> source.dussan.org Git - jgit.git/commitdiff
LfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loop 00/165500/4
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 26 Jun 2020 08:18:08 +0000 (17:18 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sun, 28 Jun 2020 23:57:38 +0000 (08:57 +0900)
When iterating over the remote URLs to find one that matches "origin",
it always exits after the first iteration whether it has found the
remote or not. The break should be inside the conditional block so
that it exits when "origin" is found, otherwise continues to iterate
over the remaining remote URLs.

Found by Sonar Lint.

Change-Id: Ic969e54071d1cf095334007c1c1bab6579044dd2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java

index cbad1b66a970ed031cd3a5077a1e21e7d4239db0..7a0ed456c1b3e7df4759ffc049ffe9c988d7940d 100644 (file)
@@ -112,8 +112,8 @@ public class LfsConnectionFactory {
                                        remoteUrl = config.getString(
                                                        ConfigConstants.CONFIG_KEY_REMOTE, remote,
                                                        ConfigConstants.CONFIG_KEY_URL);
+                                       break;
                                }
-                               break;
                        }
                        if (lfsUrl == null && remoteUrl != null) {
                                try {