Replace a hard-coded default remote's name with a constant

Change-Id: I4e369382b8a83a5c0772462d1b176b1e23910ada
This commit is contained in:
Mykola Nikishov 2009-11-25 22:37:02 +02:00
parent 6f06be9bc2
commit 7eef835ad5
4 changed files with 8 additions and 3 deletions

View File

@ -73,7 +73,7 @@
@Command(common = true, usage = "Clone a repository into a new directory")
class Clone extends AbstractFetchCommand {
@Option(name = "--origin", aliases = { "-o" }, metaVar = "name", usage = "use <name> instead of 'origin' to track upstream")
private String remoteName = "origin";
private String remoteName = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 0, required = true, metaVar = "uri-ish")
private String sourceUri;

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2008-2009, Google Inc.
* Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* and other copyright owners as documented in the project's IP log.
*
@ -48,6 +49,7 @@
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
@ -81,7 +83,7 @@ void nothin(final boolean ignored) {
}
@Argument(index = 0, metaVar = "uri-ish")
private String remote = "origin";
private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec")
private List<RefSpec> toget;

View File

@ -65,7 +65,7 @@ class Push extends TextBuiltin {
int timeout = -1;
@Argument(index = 0, metaVar = "uri-ish")
private String remote = "origin";
private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec")
private final List<RefSpec> refSpecs = new ArrayList<RefSpec>();

View File

@ -258,6 +258,9 @@ public final class Constants {
/** A gitignore file name */
public static final String GITIGNORE_FILENAME = ".gitignore";
/** Default remote name used by clone, push and fetch operations */
public static final String DEFAULT_REMOTE_NAME = "origin";
/**
* Create a new digest function for objects.
*