|
|
@ -264,11 +264,8 @@ abstract class WalkRemoteObjectDatabase { |
|
|
|
* failed, possibly due to permissions or remote disk full, etc. |
|
|
|
* failed, possibly due to permissions or remote disk full, etc. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void writeFile(final String path, final byte[] data) throws IOException { |
|
|
|
void writeFile(final String path, final byte[] data) throws IOException { |
|
|
|
final OutputStream os = writeFile(path, null, null); |
|
|
|
try (OutputStream os = writeFile(path, null, null)) { |
|
|
|
try { |
|
|
|
|
|
|
|
os.write(data); |
|
|
|
os.write(data); |
|
|
|
} finally { |
|
|
|
|
|
|
|
os.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -394,8 +391,7 @@ abstract class WalkRemoteObjectDatabase { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Collection<WalkRemoteObjectDatabase> readAlternates(final String listPath) |
|
|
|
Collection<WalkRemoteObjectDatabase> readAlternates(final String listPath) |
|
|
|
throws IOException { |
|
|
|
throws IOException { |
|
|
|
final BufferedReader br = openReader(listPath); |
|
|
|
try (BufferedReader br = openReader(listPath)) { |
|
|
|
try { |
|
|
|
|
|
|
|
final Collection<WalkRemoteObjectDatabase> alts = new ArrayList<>(); |
|
|
|
final Collection<WalkRemoteObjectDatabase> alts = new ArrayList<>(); |
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
|
String line = br.readLine(); |
|
|
|
String line = br.readLine(); |
|
|
@ -406,8 +402,6 @@ abstract class WalkRemoteObjectDatabase { |
|
|
|
alts.add(openAlternate(line)); |
|
|
|
alts.add(openAlternate(line)); |
|
|
|
} |
|
|
|
} |
|
|
|
return alts; |
|
|
|
return alts; |
|
|
|
} finally { |
|
|
|
|
|
|
|
br.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -422,14 +416,8 @@ abstract class WalkRemoteObjectDatabase { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void readPackedRefs(final Map<String, Ref> avail) |
|
|
|
protected void readPackedRefs(final Map<String, Ref> avail) |
|
|
|
throws TransportException { |
|
|
|
throws TransportException { |
|
|
|
try { |
|
|
|
try (BufferedReader br = openReader(ROOT_DIR + Constants.PACKED_REFS)) { |
|
|
|
final BufferedReader br = openReader(ROOT_DIR |
|
|
|
readPackedRefsImpl(avail, br); |
|
|
|
+ Constants.PACKED_REFS); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
readPackedRefsImpl(avail, br); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
br.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (FileNotFoundException notPacked) { |
|
|
|
} catch (FileNotFoundException notPacked) { |
|
|
|
// Perhaps it wasn't worthwhile, or is just an older repository.
|
|
|
|
// Perhaps it wasn't worthwhile, or is just an older repository.
|
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|