aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>2024-06-17 12:05:18 +0200
committersonartech <sonartech@sonarsource.com>2024-06-17 20:02:33 +0000
commitd7cbd43740bcffbdabdc0ac6e264a444e11033fd (patch)
tree473d3a78663dd3616d11cf976b845888684c9a44
parent4c564bb146c51dfb996e68888342d9d98b3e1e79 (diff)
downloadsonarqube-d7cbd43740bcffbdabdc0ac6e264a444e11033fd.tar.gz
sonarqube-d7cbd43740bcffbdabdc0ac6e264a444e11033fd.zip
SONAR-21885 LTS Backport: Fix native Git blame with Git CLI >= 2.439.9.6.92038
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitBlameCommand.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitBlameCommand.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitBlameCommand.java
index 5c4003c80da..4a1e56a883d 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitBlameCommand.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitBlameCommand.java
@@ -53,7 +53,7 @@ public class GitBlameCommand {
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 GitBlameCommand {
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);