File tree Expand file tree Collapse file tree
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments