[
https://issues.apache.org/jira/browse/SCM-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17833968#comment-17833968
]
ASF GitHub Bot commented on SCM-1022:
-------------------------------------
attiand commented on code in PR #203:
URL: https://github.com/apache/maven-scm/pull/203#discussion_r1551846585
##########
maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckinCommandTest.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.scm.provider.git.jgit.command.checkin;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.scm.PlexusJUnit4TestSupport;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.command.checkin.CheckInScmResult;
+import org.apache.maven.scm.command.checkout.CheckOutScmResult;
+import org.apache.maven.scm.provider.git.GitScmTestUtils;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+
+public class JGitCheckinCommandTest extends ScmTestCase {
Review Comment:
Good point. It turns out that the `RemoteRefUpdate.Status#UP_TO_DATE`
equivalent for gitexe is considered ok as the `git push` command returns zero.
Which seems questionable for maven-release. Nothing would be changed in the
upstream.
Which is better: To have equal behavior for both implementations, or a
successful, possibly empty release?
> jgit push failure is not failing the build
> ------------------------------------------
>
> Key: SCM-1022
> URL: https://issues.apache.org/jira/browse/SCM-1022
> Project: Maven SCM
> Issue Type: Bug
> Components: maven-scm-provider-jgit
> Affects Versions: 2.0.1
> Reporter: Mattias Andersson
> Priority: Major
>
> If the push command fails, the maven build does not fail. This means binaries
> are deployed, but the remote repo is not updated. The issue seems related to
> SCM-854.
> We use Gerrit and have the merge strategy set to "fast forward only". If
> someone pushes a commit during the release job, only an INFO message is
> logged, but the maven build is successful.
> The same use case with the maven-scm-provider-gitexe (the default) fails the
> build as expected (git push returns a non-zero exit code)
> {code:java}
> 10:28:03 [INFO] commit done: [maven-release-plugin] prepare release 2.15.0
> 10:28:03 [INFO] push changes to remote... refs/heads/master:refs/heads/master
> 10:28:03 [INFO] fetch url: ssh://xxx@xxx
> 10:28:03 [INFO] push url: ssh://xxx@xxx
> 10:28:03 [INFO] getOrCreateProvider(EdDSA) created instance of
> net.i2p.crypto.eddsa.EdDSASecurityProvider
> 10:28:03 [INFO] No detected/configured IoServiceFactoryFactory using
> Nio2ServiceFactoryFactory
> 10:28:04 [INFO] REJECTED_NONFASTFORWARD -
> RemoteRefUpdate[remoteName=refs/heads/master, REJECTED_NONFASTFORWARD,
> 1eee06203068576ddcaae4eefe0ea15a52fb49ba...3102c82c6b62d4e86c75194569c2574ac722b6dd,
> srcRef=refs/heads/master, message=null]
> 10:28:04 [INFO] 12/17 prepare:scm-tag
> 10:28:04 [INFO] Tagging release with the label 2.15.0...
> 10:28:04 [INFO] push tag [2.15.0] to remote...
> 10:28:04 [INFO] fetch url: ssh://xxx@xxx
> 10:28:04 [INFO] push url: ssh://xxx@xxx
> 10:28:05 [INFO] OK - RemoteRefUpdate[remoteName=refs/tags/2.15.0, OK,
> 0000000000000000000000000000000000000000...968d97de8331ce19d43c719e870890def5ee65d9,
> fastForward, srcRef=refs/tags/2.15.0, message=null]{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)