aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-06-25 17:46:07 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-06-25 18:03:41 -0700
commitffe0614d4db653cbcd48c19e9f599fd87cdcfaba (patch)
tree78120cd464aa4874fd39b52e3ed500349f949193 /org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
parent8a9844b2afc4e30e60759c03a1428dc99a13619e (diff)
downloadjgit-ffe0614d4db653cbcd48c19e9f599fd87cdcfaba.tar.gz
jgit-ffe0614d4db653cbcd48c19e9f599fd87cdcfaba.zip
Allow Repository.getDirectory() to be null
Some types of repositories might not be stored on local disk. For these, they will most likely return null for getDirectory() as the java.io.File type cannot describe where their storage is, its not in the host's filesystem. Document that getDirectory() can return null now, and update all current non-test callers in JGit that might run into problems on such repositories. For the most part, just act like its bare. Change-Id: I061236a691372a267fd7d41f0550650e165d2066 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index fc203f69c8..27505bef65 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -271,8 +271,10 @@ class FetchProcess {
}
private void updateFETCH_HEAD(final FetchResult result) throws IOException {
- final LockFile lock = new LockFile(new File(transport.local
- .getDirectory(), "FETCH_HEAD"));
+ File meta = transport.local.getDirectory();
+ if (meta == null)
+ return;
+ final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD"));
try {
if (lock.lock()) {
final Writer w = new OutputStreamWriter(lock.getOutputStream());