Skip to content

Commit 76169bd

Browse files
committed
Merge branch 'stable-7.5' into stable-7.6
* stable-7.5: RefDirectory#refreshPathToLooseRef: also refresh loose ref itself Change-Id: Ia6822f38dcc05f7f272efcf39153ad7964c0d76f
2 parents 585de8e + 016abe1 commit 76169bd

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ class LooseItems {
13201320
* path of a loose ref relative to the repository root
13211321
*/
13221322
void refreshPathToLooseRef(Path refPath) {
1323+
boolean failed = false;
13231324
for (int i = 1; i < refPath.getNameCount(); i++) {
13241325
File dir = fileFor(refPath.subpath(0, i).toString());
13251326
// Use Files.newInputStream(Path) as it is consistent with other
@@ -1328,7 +1329,16 @@ void refreshPathToLooseRef(Path refPath) {
13281329
try (InputStream stream = Files.newInputStream(dir.toPath())) {
13291330
// open the dir to refresh attributes (on some NFS clients)
13301331
} catch (IOException e) {
1331-
break; // loose ref may not exist
1332+
failed = true;
1333+
break; // directory may not exist
1334+
}
1335+
}
1336+
if (!failed) {
1337+
try (InputStream stream = Files.newInputStream(refPath)) {
1338+
// open the loose ref to refresh attributes (on some NFS
1339+
// clients)
1340+
} catch (IOException e) {
1341+
// loose ref may not exist
13321342
}
13331343
}
13341344
}

0 commit comments

Comments
 (0)