IndexDiff: Refactor to open Repository in try-with-resource
Change-Id: I667d685ccedc730e786f1e52323fdeba4b91af3e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
7bd2a4a7c6
commit
5639639b06
|
@ -542,10 +542,9 @@ public boolean diff(final ProgressMonitor monitor, int estWorkTreeSize,
|
||||||
JGitText.get().invalidIgnoreParamSubmodule,
|
JGitText.get().invalidIgnoreParamSubmodule,
|
||||||
smw.getPath()), e);
|
smw.getPath()), e);
|
||||||
}
|
}
|
||||||
Repository subRepo = smw.getRepository();
|
try (Repository subRepo = smw.getRepository()) {
|
||||||
if (subRepo != null) {
|
if (subRepo != null) {
|
||||||
String subRepoPath = smw.getPath();
|
String subRepoPath = smw.getPath();
|
||||||
try {
|
|
||||||
ObjectId subHead = subRepo.resolve("HEAD"); //$NON-NLS-1$
|
ObjectId subHead = subRepo.resolve("HEAD"); //$NON-NLS-1$
|
||||||
if (subHead != null
|
if (subHead != null
|
||||||
&& !subHead.equals(smw.getObjectId())) {
|
&& !subHead.equals(smw.getObjectId())) {
|
||||||
|
@ -574,8 +573,6 @@ public boolean diff(final ProgressMonitor monitor, int estWorkTreeSize,
|
||||||
recordFileMode(subRepoPath, FileMode.GITLINK);
|
recordFileMode(subRepoPath, FileMode.GITLINK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
subRepo.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue