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

[EGIT] [PATCH v3 1/1] Make sure to set up the default remote branch correctly

From
Ferry Huberts <ferry.huberts@pelagic.nl>
Date
Feb 23, 2009, 18:55 UTC
Message-ID
<0c1bcfebbad98e6e6f3432d03550f7710186d231.1235415204.git.ferry.huberts@pelagic.nl>
In-Reply-To
<cover.1235415204.git.ferry.huberts@pelagic.nl>

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

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 .../org/spearce/egit/core/op/CloneOperation.java   |   12 ++++++++++++
 1 files changed, 12 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 777894c..a5b4e50 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,17 @@ private void doInit(final IProgressMonitor monitor)
 		local.getConfig().setBoolean("core", null, "bare", false);
 
 		remoteConfig.update(local.getConfig());
+
+		// branch is like 'Constants.R_HEADS + branchName', we need only 
+		// the 'branchName' part
+		String branchName = branch.substring(Constants.R_HEADS.length());
+
+		// setup the default remote branch for branchName
+		local.getConfig().setString(RepositoryConfig.BRANCH_SECTION,
+				branchName, "remote", remoteName);
+		local.getConfig().setString(RepositoryConfig.BRANCH_SECTION,
+				branchName, "merge", branch);
+
 		local.getConfig().save();
 	}
 
-- 
1.6.0.6
Previous: Ferry HubertsNext: Robin Rosenberg
Message 2 of 3 in “Make sure to setup a clone the same as git-clone does”
  1. Ferry HubertsFeb 23, 2009
  2. [EGIT] [PATCH v3 1/1] Make sure to set up the default remote branch correctlyFerry Huberts, Feb 23, 2009
  3. Robin RosenbergFeb 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.