Skip to content

Commit 016abe1

Browse files
committed
Merge branch 'stable-7.4' into stable-7.5
* stable-7.4: RefDirectory#refreshPathToLooseRef: also refresh loose ref itself Change-Id: I3c5ca5585a6002f9bc5fbb4092d6d886b4b1237c
2 parents 0db1913 + 6efc805 commit 016abe1

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
@@ -1317,6 +1317,7 @@ class LooseItems {
13171317
* path of a loose ref relative to the repository root
13181318
*/
13191319
void refreshPathToLooseRef(Path refPath) {
1320+
boolean failed = false;
13201321
for (int i = 1; i < refPath.getNameCount(); i++) {
13211322
File dir = fileFor(refPath.subpath(0, i).toString());
13221323
// Use Files.newInputStream(Path) as it is consistent with other
@@ -1325,7 +1326,16 @@ void refreshPathToLooseRef(Path refPath) {
13251326
try (InputStream stream = Files.newInputStream(dir.toPath())) {
13261327
// open the dir to refresh attributes (on some NFS clients)
13271328
} catch (IOException e) {
1328-
break; // loose ref may not exist
1329+
failed = true;
1330+
break; // directory may not exist
1331+
}
1332+
}
1333+
if (!failed) {
1334+
try (InputStream stream = Files.newInputStream(refPath)) {
1335+
// open the loose ref to refresh attributes (on some NFS
1336+
// clients)
1337+
} catch (IOException e) {
1338+
// loose ref may not exist
13291339
}
13301340
}
13311341
}

0 commit comments

Comments
 (0)