Skip to content

Commit 27782bc

Browse files
committed
define the delimiter
1 parent 1bc7849 commit 27782bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/org/opensolaris/opengrok/history/GitRepository.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,16 @@ String determineBranch() throws IOException {
710710
String determineCurrentVersion() throws IOException {
711711
File directory = new File(directoryName);
712712
List<String> cmd = new ArrayList<>();
713+
// The delimiter must not be contained in the date format emitted by
714+
// {@code GIT_DATE_OPT}.
715+
String delim = "#";
716+
713717
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
718+
714719
cmd.add(RepoCommand);
715720
cmd.add("log");
716721
cmd.add("-1");
717-
cmd.add("--pretty=%cd# %h %an %s");
722+
cmd.add("--pretty=%cd" + delim + "%h %an %s");
718723
cmd.add(GIT_DATE_OPT);
719724

720725
Executor executor = new Executor(cmd, directory);
@@ -723,7 +728,7 @@ String determineCurrentVersion() throws IOException {
723728
}
724729

725730
String output = executor.getOutputString().trim();
726-
int indexOf = StringUtils.nthIndexOf(output, "#", 1);
731+
int indexOf = StringUtils.nthIndexOf(output, delim, 1);
727732
if (indexOf < 0) {
728733
throw new IOException(
729734
String.format("Couldn't extract date from \"%s\".",

0 commit comments

Comments
 (0)