]> source.dussan.org Git - jgit.git/commitdiff
Refactor FileRepository.detectIndexChange() 34/124234/1
authorMatthias Sohn <matthias.sohn@sap.com>
Fri, 8 Jun 2018 07:42:13 +0000 (09:42 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 8 Jun 2018 07:42:13 +0000 (09:42 +0200)
Change-Id: I50c751e2e90f685dc27043c569da2eb210d4611b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java

index 13ef94b8984c9c655a94b6f3913e7b189c188a50..d4056871b06e7d6f37dce708032d5b11c2947892 100644 (file)
@@ -557,15 +557,15 @@ public class FileRepository extends Repository {
                try {
                        if (snapshot == null) {
                                snapshot = FileSnapshot.save(indexFile);
-                       } else if (snapshot.isModified(indexFile)) {
-                               snapshotLock.unlock();
-                               notifyIndexChanged(false);
+                               return;
                        }
-               } finally {
-                       if (snapshotLock.isHeldByCurrentThread()) {
-                               snapshotLock.unlock();
+                       if (!snapshot.isModified(indexFile)) {
+                               return;
                        }
+               } finally {
+                       snapshotLock.unlock();
                }
+               notifyIndexChanged(false);
        }
 
        /** {@inheritDoc} */