Ensure a new commit exists before triggering hook

Change-Id: Ie055c0edc825da0be0c8386b6c0f1fa815db0839
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
index db8eaf9..caaafc0 100644
--- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
+++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
@@ -126,14 +126,17 @@
     // https://code.google.com/p/gerrit/issues/detail?id=2564
     // https://gerrit-review.googlesource.com/55540
     if (commit != null) {
-      ObjectId parent = ObjectId.zeroId();
+      if (!commit.equals(commitId)) {
+        ObjectId parent = ObjectId.zeroId();
 
-      if (commit.getParents().length > 0) {
-        parent = commit.getParent(0).getId();
+        if (commit.getParents().length > 0) {
+          parent = commit.getParent(0).getId();
+        }
+        changeHooks.doRefUpdatedHook(new Branch.NameKey(p, refName),
+            parent,
+            commit.getId(), null);
+
       }
-      changeHooks.doRefUpdatedHook(new Branch.NameKey(p, refName),
-                                    parent,
-                                    commit.getId(), null);
       return commit.getId();
     } else {
       log.warn("Failing to commit manifest subscription update:"+