Simplify logic in RepoCommand Instead of negative testing before return null, check for when the command should be enabled and format the string only in this case. Change-Id: I9fcbf902d62cc76965707a005f0572a8bf75e28f
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java index 26a40ec..5fa8118 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java +++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java
@@ -33,10 +33,9 @@ @Override public String getCommand(DownloadScheme scheme, String project, String ref) { - if (!commandAllowed || !(scheme instanceof RepoScheme)) { - return null; + if (commandAllowed && scheme instanceof RepoScheme) { + return scheme.getUrl(project) + " " + ref; } - - return scheme.getUrl(project) + " " + ref; + return null; } }