瀏覽代碼

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>
tags/v0.7.0
Shawn O. Pearce 14 年之前
父節點
當前提交
efa8b52df5
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

+ 1
- 1
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())

Loading…
取消
儲存