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);
// 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

Loading…
Cancel
Save