From a52b331d7158dc542944b4c5694d1e34e840f122 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 8 Aug 2019 14:42:14 +0200 Subject: [PATCH] Fix formatting and add missing braces in Repository#stripWorkDir Change-Id: I601d917f3741e0207a8ee7a365d9c2dea6422401 Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/lib/Repository.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 35e3c5a50..68866ea27 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1536,10 +1536,11 @@ public abstract class Repository implements AutoCloseable { final String filePath = file.getPath(); final String workDirPath = workDir.getPath(); - if (filePath.length() <= workDirPath.length() || - filePath.charAt(workDirPath.length()) != File.separatorChar || - !filePath.startsWith(workDirPath)) { - File absWd = workDir.isAbsolute() ? workDir : workDir.getAbsoluteFile(); + if (filePath.length() <= workDirPath.length() + || filePath.charAt(workDirPath.length()) != File.separatorChar + || !filePath.startsWith(workDirPath)) { + File absWd = workDir.isAbsolute() ? workDir + : workDir.getAbsoluteFile(); File absFile = file.isAbsolute() ? file : file.getAbsoluteFile(); if (absWd.equals(workDir) && absFile.equals(file)) { return ""; //$NON-NLS-1$ @@ -1548,8 +1549,9 @@ public abstract class Repository implements AutoCloseable { } String relName = filePath.substring(workDirPath.length() + 1); - if (File.separatorChar != '/') + if (File.separatorChar != '/') { relName = relName.replace(File.separatorChar, '/'); + } return relName; }