From d474e0fe7bec27274ad7d6eb08a37f7fcea5e7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Tue, 15 Feb 2022 09:50:29 +0100 Subject: [PATCH] Push commits before tags Some Git servers like Gerrit do not support tag push before commit push. --- src/main/java/io/jenkins/plugins/git_push/GitPushCommand.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/jenkins/plugins/git_push/GitPushCommand.java b/src/main/java/io/jenkins/plugins/git_push/GitPushCommand.java index 685d6a9..a5a7d93 100644 --- a/src/main/java/io/jenkins/plugins/git_push/GitPushCommand.java +++ b/src/main/java/io/jenkins/plugins/git_push/GitPushCommand.java @@ -47,6 +47,7 @@ public void call(String targetBranch, String targetRepo) git.fetch_().from(remoteURI, remote.getFetchRefSpecs()).execute(); ObjectId remoteRev = git.revParse(targetRepo + "/" + targetBranch); git.merge().setRevisionToMerge(remoteRev).execute(); + git.push().to(remoteURI).ref("HEAD:" + targetBranch).execute(); git.push().to(remoteURI).ref("HEAD:" + targetBranch).tags(true).execute(); git.fetch_().from(remoteURI, remote.getFetchRefSpecs()).execute(); } catch (GitException e) {