Skip to content

Commit

Permalink
Options should precede operands to git commands
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Sep 9, 2019
1 parent c06111d commit 2ac7394
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
Expand Up @@ -404,15 +404,6 @@ public void execute() throws GitException, InterruptedException {
if (isAtLeastVersion(1,7,1,0))
args.add("--progress");

StandardCredentials cred = credentials.get(url.toPrivateString());
if (cred == null) cred = defaultCredentials;
args.add(url);

if (refspecs != null)
for (RefSpec rs: refspecs)
if (rs != null)
args.add(rs.toString());

if (prune) args.add("--prune");

if (shallow) {
Expand All @@ -424,6 +415,15 @@ public void execute() throws GitException, InterruptedException {

warnIfWindowsTemporaryDirNameHasSpaces();

StandardCredentials cred = credentials.get(url.toPrivateString());
if (cred == null) cred = defaultCredentials;
addCheckedRemoteUrl(args, url.toPrivateASCIIString());

if (refspecs != null)
for (RefSpec rs: refspecs)
if (rs != null)
args.add(rs.toString());

/* If url looks like a remote name reference, convert to remote URL for authentication */
/* See JENKINS-50573 for more details */
/* "git remote add" rejects remote names with ':' (and it is a common character in remote URLs) */
Expand Down

0 comments on commit 2ac7394

Please sign in to comment.