Skip to content
Snippets Groups Projects
Commit 7eef835a authored by Mykola Nikishov's avatar Mykola Nikishov
Browse files

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

Change-Id: I4e369382b8a83a5c0772462d1b176b1e23910ada
parent 6f06be9b
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
@Command(common = true, usage = "Clone a repository into a new directory") @Command(common = true, usage = "Clone a repository into a new directory")
class Clone extends AbstractFetchCommand { class Clone extends AbstractFetchCommand {
@Option(name = "--origin", aliases = { "-o" }, metaVar = "name", usage = "use <name> instead of 'origin' to track upstream") @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") @Argument(index = 0, required = true, metaVar = "uri-ish")
private String sourceUri; private String sourceUri;
......
/* /*
* Copyright (C) 2008-2009, Google Inc. * Copyright (C) 2008-2009, Google Inc.
* Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.TextProgressMonitor; import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.transport.FetchResult; import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RefSpec;
...@@ -81,7 +83,7 @@ void nothin(final boolean ignored) { ...@@ -81,7 +83,7 @@ void nothin(final boolean ignored) {
} }
@Argument(index = 0, metaVar = "uri-ish") @Argument(index = 0, metaVar = "uri-ish")
private String remote = "origin"; private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec") @Argument(index = 1, metaVar = "refspec")
private List<RefSpec> toget; private List<RefSpec> toget;
......
...@@ -65,7 +65,7 @@ class Push extends TextBuiltin { ...@@ -65,7 +65,7 @@ class Push extends TextBuiltin {
int timeout = -1; int timeout = -1;
@Argument(index = 0, metaVar = "uri-ish") @Argument(index = 0, metaVar = "uri-ish")
private String remote = "origin"; private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec") @Argument(index = 1, metaVar = "refspec")
private final List<RefSpec> refSpecs = new ArrayList<RefSpec>(); private final List<RefSpec> refSpecs = new ArrayList<RefSpec>();
......
...@@ -258,6 +258,9 @@ public final class Constants { ...@@ -258,6 +258,9 @@ public final class Constants {
/** A gitignore file name */ /** A gitignore file name */
public static final String GITIGNORE_FILENAME = ".gitignore"; 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. * Create a new digest function for objects.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment