From b3254d1159b30573b5f658394cefe877f44c4b78 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Jun 2010 16:37:38 -0700 Subject: [PATCH] isValidRefName: Inline the forbidden ref suffix of ".lock" A Git reference name must never end with ".lock", as it would confuse any existing C client that tries to obtain a clone of the repository over the network. Even if the repository isn't on a local filesystem, it still should ban that suffix. Because I plan to move LockFile to storage.file and make it a private implementation detail of the local file system storage model, we can't rely on its package level SUFFIX field here. Making it public probably won't work long-term either, as I also plan to pull storage.file into its own separate project that depends on the core library. So, just inline the constant here. Its as foribidden as ":" is. Change-Id: If85076861baeacc183b82696375a13e935ba8836 Signed-off-by: Shawn O. Pearce --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index a71640460..350d11f43 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1248,7 +1248,7 @@ public static boolean isValidRefName(final String refName) { final int len = refName.length(); if (len == 0) return false; - if (refName.endsWith(LockFile.SUFFIX)) + if (refName.endsWith(".lock")) return false; int components = 1;