Skip to content

Commit

Permalink
Off by one in gh-133
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNielsen committed Aug 15, 2018
1 parent c7219e8 commit 894792a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public static void pushToIntegrationBranchGit(Run<?, ?> run, TaskListener listen
}
}

public static void pushToBranch(TaskListener listener, GitClient client, String sourceLocalBranch, String targetRemoteBranch, String expandedRepo) throws PushFailedException {
pushToBranch(listener, client, sourceLocalBranch, targetRemoteBranch, expandedRepo, 0);
}

public static void pushToBranch(TaskListener listener, GitClient client, String sourceLocalBranch, String targetRemoteBranch, String expandedRepo, int retries) throws PushFailedException {
try {
LOGGER.log(Level.INFO, "Pushing changes from local branch: " + sourceLocalBranch + " to remote branch: " + targetRemoteBranch);
Expand All @@ -89,7 +93,7 @@ public static void pushToBranch(TaskListener listener, GitClient client, String
} catch (GitException gex) {
final Pattern nonFastForward = Pattern.compile(".*[rejected].*\\(non-fast-forward\\).*", Pattern.DOTALL);
//Something is wrong on the remote and it's not a fast forward issue...try again
if (gex.getMessage() != null && !nonFastForward.matcher(gex.getMessage()).matches() && retries >= 0) {
if (gex.getMessage() != null && !nonFastForward.matcher(gex.getMessage()).matches() && retries > 0) {
LOGGER.log(Level.WARNING, LOG_PREFIX + "Failed to push...retrying in 5 seconds");
listener.getLogger().println(LOG_PREFIX + "Failed to push...retrying in 5 seconds");
try {
Expand Down

0 comments on commit 894792a

Please sign in to comment.