aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-03-19 14:31:27 +0100
committersonartech <sonartech@sonarsource.com>2024-03-19 20:02:38 +0000
commitf0217afa1856121b10c4a50d40b4038efb14b318 (patch)
treedae9903ef6804c902dcb99602f527e0e2d67e66b /sonar-scanner-engine
parent5861f25d04e14042f09e78e45f3bf412a133f3a8 (diff)
downloadsonarqube-f0217afa1856121b10c4a50d40b4038efb14b318.tar.gz
sonarqube-f0217afa1856121b10c4a50d40b4038efb14b318.zip
SONAR-21885 Fix native Git blame with Git CLI >= 2.43
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java
index 23ac5478766..a4dede66e08 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java
@@ -53,7 +53,7 @@ public class NativeGitBlameCommand {
private static final String MINIMUM_REQUIRED_GIT_VERSION = "2.24.0";
private static final String DEFAULT_GIT_COMMAND = "git";
private static final String BLAME_LINE_PORCELAIN_FLAG = "--line-porcelain";
- private static final String END_OF_OPTIONS_FLAG = "--end-of-options";
+ private static final String FILENAME_SEPARATOR_FLAG = "--";
private static final String IGNORE_WHITESPACES = "-w";
private static final Pattern whitespaceRegex = Pattern.compile("\\s+");
@@ -128,7 +128,7 @@ public class NativeGitBlameCommand {
gitCommand,
GIT_DIR_FLAG, String.format(GIT_DIR_ARGUMENT, baseDir), GIT_DIR_FORCE_FLAG, baseDir.toString(),
BLAME_COMMAND,
- BLAME_LINE_PORCELAIN_FLAG, IGNORE_WHITESPACES, END_OF_OPTIONS_FLAG, fileName)
+ BLAME_LINE_PORCELAIN_FLAG, IGNORE_WHITESPACES, FILENAME_SEPARATOR_FLAG, fileName)
.execute();
} catch (UncommittedLineException e) {
LOG.debug("Unable to blame file '{}' - it has uncommitted changes", fileName);