[JGIT PATCH 03/11] Don't retry ".git" suffix in daemon if already tried

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the name we already tried ended in ".git", don't append ".git"
(creating "foo.git.git") and search the map again.  Instead the
names are normalized to always end with ".git", and ".git" is put
on the end if it is not present in the user request.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/transport/Daemon.java     |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java b/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
index 7b4c138..f55e049 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
@@ -195,7 +195,9 @@ public void setExportAll(final boolean export) {
 	 * @param db
 	 *            the repository instance.
 	 */
-	public void exportRepository(final String name, final Repository db) {
+	public void exportRepository(String name, final Repository db) {
+		if (!name.endsWith(".git"))
+			name = name + ".git";
 		exports.put(name, db);
 	}
 
@@ -347,11 +349,7 @@ Repository openRepository(String name) {
 		name = name.substring(1);
 
 		Repository db;
-		db = exports.get(name);
-		if (db != null)
-			return db;
-
-		db = exports.get(name + ".git");
+		db = exports.get(name.endsWith(".git") ? name : name + ".git");
 		if (db != null)
 			return db;
 
-- 
1.6.4.rc0.117.g28cb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]