From 1b4e80e9166bb57f937f8b8687f569b8526a60bc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 16 May 2007 20:08:45 -0400 Subject: [PATCH] Allow RefLock to be used for other files When we create a symbolic-ref (for example) we want to use the same locking system as we do for normal refs, as that is what core Git does, and its just nice to reuse code that is already thought to be stable. Here I'm just exposing the constructor to allow creation of a RefLock against any file path, not just one that is a Ref. Signed-off-by: Shawn O. Pearce --- org.spearce.jgit/src/org/spearce/jgit/lib/RefLock.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefLock.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefLock.java index 9921f4fa..3f813663 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefLock.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefLock.java @@ -35,7 +35,11 @@ public class RefLock { private FileOutputStream os; public RefLock(final Ref r) { - ref = r.getFile(); + this(r.getFile()); + } + + public RefLock(final File f) { + ref = f; lck = new File(ref.getParentFile(), ref.getName() + ".lock"); } -- 2.11.4.GIT