Browse Source

SubmoduleStatusCommand: Open Repository in try-with-resource

Change-Id: Id65c8a94d43bc01e76733eb2ff87635d0f8a8dc2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
c6a2c58624
  1. 14
      org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java

14
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java

@ -130,16 +130,14 @@ public class SubmoduleStatusCommand extends
id); id);
// Report uninitialized if no submodule repository // Report uninitialized if no submodule repository
Repository subRepo = generator.getRepository(); ObjectId headId = null;
if (subRepo == null) try (Repository subRepo = generator.getRepository()) {
return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED, path, if (subRepo == null) {
id); return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED,
path, id);
}
ObjectId headId;
try {
headId = subRepo.resolve(Constants.HEAD); headId = subRepo.resolve(Constants.HEAD);
} finally {
subRepo.close();
} }
// Report uninitialized if no HEAD commit in submodule repository // Report uninitialized if no HEAD commit in submodule repository

Loading…
Cancel
Save