summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2018-06-08 09:42:13 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2018-06-08 09:42:13 +0200
commitb782518caedc7b20e3d568f78a5a1d2b0aa17424 (patch)
tree1ac2cc6b2be3952e9f213801d628e4e43d93dce5
parentf98112289cd6e919812778f532e4f6398922d7ff (diff)
downloadjgit-b782518caedc7b20e3d568f78a5a1d2b0aa17424.tar.gz
jgit-b782518caedc7b20e3d568f78a5a1d2b0aa17424.zip
Refactor FileRepository.detectIndexChange()
Change-Id: I50c751e2e90f685dc27043c569da2eb210d4611b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index 13ef94b898..d4056871b0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -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} */