From: Shawn O. Pearce Date: Tue, 22 Jun 2010 23:37:38 +0000 (-0700) Subject: isValidRefName: Inline the forbidden ref suffix of ".lock" X-Git-Tag: v0.9.1~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b3254d1159b30573b5f658394cefe877f44c4b78;p=jgit.git 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 --- 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 a71640460d..350d11f43b 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 class Repository { final int len = refName.length(); if (len == 0) return false; - if (refName.endsWith(LockFile.SUFFIX)) + if (refName.endsWith(".lock")) return false; int components = 1;