From 8e2c17ca2addd984f1ba239aca27f19698606ed9 Mon Sep 17 00:00:00 2001
From: "Shawn O. Pearce" <spearce@spearce.org>
Date: Thu, 11 Mar 2010 11:58:09 -0800
Subject: [PATCH] eclipse-iplog: Require at least one project section

We need at least one project definition to dump out a reasonably
sane IP log file in XML format.

Change-Id: I5cfcd70cd98e29159014cf3dbf0433dd9c49d49c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/eclipse/jgit/iplog/IpLogGenerator.java          | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
index 040887ece..417c50655 100644
--- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
+++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
@@ -211,6 +211,12 @@ private void loadEclipseIpLog(String version, RevCommit commit)
 					+ " is invalid", e);
 		}
 
+		if (meta.getProjects().isEmpty()) {
+			throw new ConfigInvalidException("Configuration file "
+					+ log.getPathString() + " in commit " + commit.name()
+					+ " has no projects declared.");
+		}
+
 		for (Project p : meta.getProjects()) {
 			p.setVersion(version);
 			projects.put(p.getName(), p);
-- 
GitLab