diff options
author | John Ross <jwross@us.ibm.com> | 2013-11-21 13:48:42 -0600 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-12-02 16:31:45 +0100 |
commit | 99608f0b9a10abe0f8426f0ff5bc51eb6a2ae866 (patch) | |
tree | 64b3f04dd97a630ebb616f49767a6d549bc3a3ef /org.eclipse.jgit | |
parent | 591998c2d628ec4f6309caea826fab16a6de2adc (diff) | |
download | jgit-99608f0b9a10abe0f8426f0ff5bc51eb6a2ae866.tar.gz jgit-99608f0b9a10abe0f8426f0ff5bc51eb6a2ae866.zip |
Fix broken symbolic links on Cygwin.
Bad files from symbolic links were being generated on Cygwin and
required resolution by the appropriate FS. Pass FS to getSymRef and call
FS.resolve before asking if the file is absolute.
Bug: 419494
Change-Id: I74aa7a285954cade77f41df6f813b6dafb5d6cd7
Signed-off-by: John Ross <jwross@us.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index 28d90590a3..db622f319d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -100,7 +100,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re && ref[7] == ' '; } - private static File getSymRef(File workTree, File dotGit) + private static File getSymRef(File workTree, File dotGit, FS fs) throws IOException { byte[] content = IO.readFully(dotGit); if (!isSymRef(content)) @@ -116,7 +116,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re JGitText.get().invalidGitdirRef, dotGit.getAbsolutePath())); String gitdirPath = RawParseUtils.decode(content, pathStart, lineEnd); - File gitdirFile = new File(gitdirPath); + File gitdirFile = fs.resolve(workTree, gitdirPath); if (gitdirFile.isAbsolute()) return gitdirFile; else @@ -516,7 +516,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re break; } else if (dir.isFile()) try { - setGitDir(getSymRef(current, dir)); + setGitDir(getSymRef(current, dir, tryFS)); break; } catch (IOException ignored) { // Continue searching if gitdir ref isn't found @@ -597,7 +597,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re if (!dotGit.isFile()) setGitDir(dotGit); else - setGitDir(getSymRef(getWorkTree(), dotGit)); + setGitDir(getSymRef(getWorkTree(), dotGit, safeFS())); } } |