git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT] [PATCH 2/2] Make sure to set up the default (pull) remote branch for master

From
ferry.huberts@pelagic.nl <ferry.huberts@pelagic.nl>
Date
Feb 21, 2009, 15:17 UTC
Message-ID
<e26eb3c2a7a0ce2b96252f00c17a62913d741579.1235228532.git.ferry.huberts@pelagic.nl>
In-Reply-To
<80065b1339c7b235b19fa1f5a40a58dca335ae91.1235228532.git.ferry.huberts@pelagic.nl>
From: Ferry Huberts <ferry.huberts@pelagic.nl>

This is to make sure that the git plugin sets up a clone in the same fashion as the CLI git clone command.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 .../org/spearce/egit/core/op/CloneOperation.java   |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/CloneOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/CloneOperation.java
index f9ff6a3..ad786cb 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/CloneOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/CloneOperation.java
@@ -32,6 +32,7 @@
 import org.spearce.jgit.lib.Ref;
 import org.spearce.jgit.lib.RefUpdate;
 import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.RepositoryConfig;
 import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.WorkDirCheckout;
 import org.spearce.jgit.transport.FetchResult;
@@ -158,6 +159,11 @@ private void doInit(final IProgressMonitor monitor)
 		local.getConfig().setBoolean("core", null, "bare", false);
 		
 		remoteConfig.update(local.getConfig());
+
+		/* setup the default (pull) remote branch for master */
+		local.getConfig().setString(RepositoryConfig.BRANCH_SECTION, Constants.MASTER, "remote", remoteName);
+		local.getConfig().setString(RepositoryConfig.BRANCH_SECTION, Constants.MASTER, "merge", Constants.R_HEADS + Constants.MASTER);
+
 		local.getConfig().save();
 	}
 
-- 
1.6.0.6
Previous: ferry.huberts@pelagic.nlNext: Shawn O. Pearce
Message 3 of 7 in “Make sure to setup a clone the same as git-clone does”
  1. ferry.huberts@pelagic.nlFeb 21, 2009
  2. [EGIT] [PATCH 1/2] Make sure to set core.bare to false when cloningferry.huberts@pelagic.nl, Feb 21, 2009
  3. [EGIT] [PATCH 2/2] Make sure to set up the default (pull) remote branch for masterferry.huberts@pelagic.nl, Feb 21, 2009
  4. Shawn O. PearceFeb 23, 2009
  5. Ferry Huberts (Pelagic)Feb 23, 2009
  6. Shawn O. PearceFeb 23, 2009
  7. Shawn O. PearceFeb 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.