This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new c4a422ebaf Make rejected push message more clear, fixes #5163 (#5833)
c4a422ebaf is described below

commit c4a422ebaf302c7d88ebf8043925a10dbed60f40
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Oct 15 14:49:44 2025 +0200

    Make rejected push message more clear, fixes #5163 (#5833)
---
 .../main/java/org/apache/hop/git/model/UIGit.java  | 36 ++++++++++++++++------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java 
b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
index 03dfe13016..97ab9f7a47 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
@@ -645,15 +645,33 @@ public class UIGit extends VCS {
               .filter(update -> update.getStatus() != 
RemoteRefUpdate.Status.OK)
               .filter(update -> update.getStatus() != 
RemoteRefUpdate.Status.UP_TO_DATE)
               .forEach(
-                  update -> // for each failed refspec
-                  sb.append(
-                          result.getURI().toString()
-                              + "\n"
-                              + update.getSrcRef()
-                              + "\n"
-                              + update.getStatus().toString()
-                              + (update.getMessage() == null ? "" : "\n" + 
update.getMessage())
-                              + "\n\n"));
+                  // for each failed refspec
+                  update -> {
+                    sb.append("Errors while pushing: ")
+                        .append("\n")
+                        .append("Destination: ")
+                        .append(result.getURI().toString())
+                        .append("\n")
+                        .append("Branch name: ")
+                        .append(update.getSrcRef())
+                        .append("\n");
+                    switch (update.getStatus()) {
+                      case REJECTED_NONFASTFORWARD:
+                        sb.append(" * ")
+                            .append(update.getStatus().toString())
+                            .append(
+                                " - Remote repository contains changes. Merge 
the remote changes (e.g. 'git pull') before pushing again.")
+                            .append("\n");
+                        break;
+                      default:
+                        sb.append(" * ")
+                            .append(update.getStatus().toString())
+                            .append(" - ")
+                            .append(update.getMessage() == null ? "" : "\n" + 
update.getMessage())
+                            .append("\n");
+                        break;
+                    }
+                  });
           if (sb.isEmpty()) {
             showMessageBox(
                 BaseMessages.getString(PKG, "Dialog.Success"),

Reply via email to