]> source.dussan.org Git - jgit.git/commitdiff
clone: Correct formatting of init message 03/1603/1
authorShawn O. Pearce <spearce@spearce.org>
Wed, 15 Sep 2010 15:44:27 +0000 (08:44 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 15 Sep 2010 15:47:17 +0000 (08:47 -0700)
We used the wrong format method, which lead to this confusing output:

  $ ./jgit clone git://...
  Initialized empty Git repository in {0}
  remote: Counting objects: 201783
  ...
  remote: {0}

We need to use MessageFormat.format() as the message translations
use {0} syntax and not %s syntax for placeholders.

Change-Id: I8bf0fd3f7dbecf9edf47419c46aed0493d405f9e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java

index 356966ab5984676862bab18b6002a8b723541aa1..fd7fd4459bd72249fbe54d8df8598d3db0a50857 100644 (file)
@@ -49,6 +49,7 @@ package org.eclipse.jgit.pgm;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.text.MessageFormat;
 
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
@@ -104,16 +105,19 @@ abstract class AbstractFetchCommand extends TextBuiltin {
                        else if (0 <= cr)
                                s = cr;
                        else {
-                               writer.format(CLIText.get().remoteMessage, pkt);
+                               writer.print(MessageFormat.format(CLIText.get().remoteMessage,
+                                               pkt));
                                writer.println();
                                break;
                        }
 
                        if (pkt.charAt(s) == '\r') {
-                               writer.format(CLIText.get().remoteMessage, pkt.substring(0, s));
+                               writer.print(MessageFormat.format(CLIText.get().remoteMessage,
+                                               pkt.substring(0, s)));
                                writer.print('\r');
                        } else {
-                               writer.format(CLIText.get().remoteMessage, pkt.substring(0, s));
+                               writer.print(MessageFormat.format(CLIText.get().remoteMessage,
+                                               pkt.substring(0, s)));
                                writer.println();
                        }
 
index 1b1a8c28e8cc96ea60aeb3ffdc8581762d13c064..1b0498967071aa51f050ad8b630dc9737878bb28 100644 (file)
@@ -114,7 +114,9 @@ class Clone extends AbstractFetchCommand {
                dst.getConfig().save();
                db = dst;
 
-               out.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath());
+               out.print(MessageFormat.format(
+                               CLIText.get().initializedEmptyGitRepositoryIn, gitdir
+                                               .getAbsolutePath()));
                out.println();
                out.flush();