Change-Id: Id65c8a94d43bc01e76733eb2ff87635d0f8a8dc2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
id);
// Report uninitialized if no submodule repository
- Repository subRepo = generator.getRepository();
- if (subRepo == null)
- return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED, path,
- id);
+ ObjectId headId = null;
+ try (Repository subRepo = generator.getRepository()) {
+ if (subRepo == null) {
+ return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED,
+ path, id);
+ }
- ObjectId headId;
- try {
headId = subRepo.resolve(Constants.HEAD);
- } finally {
- subRepo.close();
}
// Report uninitialized if no HEAD commit in submodule repository