]> source.dussan.org Git - jgit.git/commitdiff
Simplify push error message when ref already exists 55/8255/2
authorShawn O. Pearce <spearce@spearce.org>
Wed, 17 Oct 2012 14:55:15 +0000 (07:55 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 18 Oct 2012 01:04:25 +0000 (18:04 -0700)
If a client attempts to create a branch that already exists on the
remote side, tell them "already exists" rather than repeat lots of
information about the reference. Previously the error looked like:

  ! [remote rejected] tags/1.3.1 -> 1.3.1 (Ref Ref[refs/tags/1.3.1=e3857ee05...] already exists)

Now it will simply say:

  ! [remote rejected] tags/1.3.1 -> 1.3.1 (already exists)

Change-Id: I96fc67ca8b650052de6e662449a3c5bc8bbc010b

org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

index 2e974d6252b5565bb2089dde3d09efcf1a62f950..8a0ce87ee1c513fe3e1f8d8020edae6387d9c58a 100644 (file)
@@ -377,7 +377,8 @@ readTimedOut=Read timed out
 receivePackObjectTooLarge1=Object too large, rejecting the pack. Max object size limit is {0} bytes.
 receivePackObjectTooLarge2=Object too large ({0} bytes), rejecting the pack. Max object size limit is {1} bytes.
 receivingObjects=Receiving objects
-refAlreadyExists=Ref {0} already exists
+refAlreadyExists=already exists
+refAlreadyExists1=Ref {0} already exists
 reflogEntryNotFound=Entry {0} not found  in reflog for ''{1}''
 refNotResolved=Ref {0} can not be resolved
 refUpdateReturnCodeWas=RefUpdate return code was: {0}
index 4fb3c174cddd03218fba68e3eb206018da8ec792..0cd478cd54c306ca0124e01a18dd4c7fae602fa4 100644 (file)
@@ -131,7 +131,7 @@ public class CreateBranchCommand extends GitCommand<Ref> {
                                        && refToCheck.getName().startsWith(Constants.R_HEADS);
                        if (!force && exists)
                                throw new RefAlreadyExistsException(MessageFormat.format(
-                                               JGitText.get().refAlreadyExists, name));
+                                               JGitText.get().refAlreadyExists1, name));
 
                        ObjectId startAt = getStartPoint();
                        String startPointFullName = null;
index f9cb828d8e696eabe3aefc08fd563099a4de407f..22f4ef986268508300c4e1f66b23f6d387312eb1 100644 (file)
@@ -108,7 +108,7 @@ public class RenameBranchCommand extends GitCommand<Ref> {
                        String fullNewName;
                        if (repo.getRef(newName) != null)
                                throw new RefAlreadyExistsException(MessageFormat.format(
-                                               JGitText.get().refAlreadyExists, newName));
+                                               JGitText.get().refAlreadyExists1, newName));
                        if (oldName != null) {
                                Ref ref = repo.getRef(oldName);
                                if (ref == null)
index 0c0ece7d1032876d92c6f60b413f7d9323503883..ef4f3b441902cc3e104a65e5af1d61ca755f9ca7 100644 (file)
@@ -438,6 +438,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String receivePackObjectTooLarge2;
        /***/ public String receivingObjects;
        /***/ public String refAlreadyExists;
+       /***/ public String refAlreadyExists1;
        /***/ public String reflogEntryNotFound;
        /***/ public String refNotResolved;
        /***/ public String refUpdateReturnCodeWas;
index 2e2de82166144c1d9960d4be094392fa944a59f4..57ccdccfda5d67c7012ffdcf270b6ebf8efe83a2 100644 (file)
@@ -55,7 +55,6 @@ import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -1055,8 +1054,8 @@ public abstract class BaseReceivePack {
                                        // A well behaved client shouldn't have sent us a
                                        // create command for a ref we advertised to it.
                                        //
-                                       cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat
-                                                       .format(JGitText.get().refAlreadyExists, ref));
+                                       cmd.setResult(Result.REJECTED_OTHER_REASON,
+                                                       JGitText.get().refAlreadyExists);
                                        continue;
                                }
                        }