Remove diffing code.

This simplifies the code, and makes it correct in the face of changes
to included XML files.

The real solution would be to fix the JGit command, where a new commit
would be elided if there was no change in the resulting tree.

Change-Id: I11dcbb65e005a8f665e30391d4acac9ab164b7c7
diff --git a/src/main/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java b/src/main/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
index 88a614e..476f244 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
@@ -150,31 +150,6 @@
     }
   }
 
-  private static boolean hasDiff(
-      GitRepositoryManager repoManager, String repoName, String oldId, String newId, String path)
-      throws IOException {
-    if (oldId.equals(ObjectId.toString(null))) {
-      return true;
-    }
-
-    Project.NameKey projectName = new Project.NameKey(repoName);
-
-    try (Repository repo = repoManager.openRepository(projectName);
-        RevWalk rw = new RevWalk(repo)) {
-
-      RevCommit c1 = rw.parseCommit(ObjectId.fromString(oldId));
-      if (c1 == null) {
-        return true;
-      }
-      RevCommit c2 = rw.parseCommit(ObjectId.fromString(newId));
-
-      try (TreeWalk tw = TreeWalk.forPath(repo, path, c1.getTree().getId(), c2.getTree().getId())) {
-
-        return !tw.getObjectId(0).equals(tw.getObjectId(1));
-      }
-    }
-  }
-
   /*
      [superproject "submodules:refs/heads/nyc"]
         srcRepo = platforms/manifest
@@ -351,19 +326,6 @@
       }
 
       try {
-        if (!hasDiff(
-            repoManager,
-            event.getProjectName(),
-            event.getOldObjectId(),
-            event.getNewObjectId(),
-            c.xmlPath)) {
-          continue;
-        }
-      } catch (IOException e) {
-        log.error("ignoring hasDiff error for" + c.toString() + ":", e.toString());
-      }
-
-      try {
         update(c, event.getRefName());
       } catch (IOException | GitAPIException e) {
         // We are in an asynchronously called listener, so there is no user action
diff --git a/src/test/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestIT.java b/src/test/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestIT.java
index 55b6104..770d0cc 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestIT.java
@@ -283,9 +283,11 @@
             + "  srcRef = refs/heads/master\n"
             + "  srcPath = super.xml\n");
 
-    // trigger XML change to verify that it worked.
+    // Push a change to the source branch. We intentionally change the included XML file
+    // (rather than the one mentioned in srcPath), to double check that we don't try to be too
+    // smart about eliding nops.
     pushFactory
-        .create(db, admin.getIdent(), manifestRepo, "Subject", "super.xml", superXml + " ")
+        .create(db, admin.getIdent(), manifestRepo, "Subject", "default.xml", xml + " ")
         .to("refs/heads/master")
         .assertOkStatus();