diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-02-01 00:51:28 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-02-01 00:52:23 -0800 |
commit | efa8b52df5627b0d0d17e312e9d585b6232ceed6 (patch) | |
tree | f15e09311d7c1be0f67297ddd9f4b987ada7a517 | |
parent | 8c2d0455d1d98a4f3d57515d048d33a8c7199730 (diff) | |
download | jgit-efa8b52df5627b0d0d17e312e9d585b6232ceed6.tar.gz jgit-efa8b52df5627b0d0d17e312e9d585b6232ceed6.zip |
Fix server side NPE during push to empty repository
If the repository is empty, we have no HEAD branch, which means we
can't test to see if the HEAD is detached and should be advertised
as a .have line.
Change-Id: I6e85f836e7db057cede812d0d6c1aecbd6cbe6c5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 15bdf9618f..35c52bdfe2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -592,7 +592,7 @@ public class ReceivePack { refs = db.getAllRefs(); final Ref head = refs.remove(Constants.HEAD); adv.send(refs); - if (!head.isSymbolic()) + if (head != null && !head.isSymbolic()) adv.advertiseHave(head.getObjectId()); adv.includeAdditionalHaves(); if (adv.isEmpty()) |