Skip to content

Commit

Permalink
Don't use buggy clone
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Mar 28, 2024
1 parent 9b182ff commit 224194b
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ protected ScmResult executeCommand(
if (fileSet.getFileList().isEmpty()) {
infoItems.add(executeInfoCommand(baseCli, parameters, fileSet.getBasedir()));
} else {
// Insert a separator to make sure that files aren't interpreted as part of the version spec
baseCli.createArg().setValue("--");
// iterate over files
for (File scmFile : fileSet.getFileList()) {
Commandline cliClone = (Commandline) baseCli.clone();
GitCommandLineUtils.addTarget(cliClone, Collections.singletonList(scmFile));
infoItems.add(executeInfoCommand(cliClone, parameters, scmFile));
baseCli = GitCommandLineUtils.getBaseGitCommandLine(fileSet.getBasedir(), "log");
baseCli.createArg().setValue("-1"); // only most recent commit matters
baseCli.createArg().setValue("--no-merges"); // skip merge commits
baseCli.addArg(GitInfoConsumer.getFormatArgument());
// Insert a separator to make sure that files aren't interpreted as part of the version spec
baseCli.createArg().setValue("--");
GitCommandLineUtils.addTarget(baseCli, Collections.singletonList(scmFile));
infoItems.add(executeInfoCommand(baseCli, parameters, scmFile));
}
}
return new InfoScmResult(baseCli.toString(), infoItems);
Expand Down

0 comments on commit 224194b

Please sign in to comment.