[EGIT PATCH 1/2] Make Git property page cope with empty repositories and not yet born branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---
 .../preferences/GitProjectPropertyPage.java        |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
index 4c97cc8..d3afd97 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
@@ -94,7 +94,13 @@ private void fillValues(Repository repository) throws IOException {
 
 		final ObjectId objectId = repository
 				.resolve(repository.getFullBranch());
-		id.setText(objectId.name());
+		if (objectId == null) {
+			if (repository.getAllRefs().size() == 0)
+				id.setText("None (empty repository)");
+			else
+				id.setText("None (unborn branch)");
+		} else
+			id.setText(objectId.name());
 	}
 
 	/**
-- 
1.6.2.2.446.gfbdc0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]