summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/index.php b/index.php
index fb64f51..0dc1f88 100644
--- a/index.php
+++ b/index.php
@@ -52,7 +52,7 @@ function parse_log(string $path): array {
$proxy = md5(strval(microtime(true)));
$process = proc_open(
- "git -C \"{$path}\" log " . "--pretty=format:'{%n {$proxy}commit{$proxy}: {$proxy}%H{$proxy},%n {$proxy}author{$proxy}: {$proxy}%aN <%aE>{$proxy},%n {$proxy}date{$proxy}: {$proxy}%ad{$proxy},%n {$proxy}message{$proxy}: {$proxy}%s{$proxy}%n},'",
+ "git -C \"{$path}\" log " . "--pretty=format:'{{$proxy}commit{$proxy}: {$proxy}%H{$proxy}, {$proxy}author{$proxy}: {$proxy}%aN <%aE>{$proxy}, {$proxy}date{$proxy}: {$proxy}%ad{$proxy}, {$proxy}message{$proxy}: {$proxy}%B{$proxy}},'",
[
["pipe", "r"],
["pipe", "w"],
@@ -62,7 +62,13 @@ function parse_log(string $path): array {
);
$output = stream_get_contents($pipes[1]);
- $string = str_replace(['"', $proxy], ['\\"', '"'], $output);
+
+ // remove git-added newlines
+ $string = str_replace("},\n{", "},{", $output);
+ $string = rtrim($string, "\n");
+
+ $string = str_replace("\n", "\\n", $string);
+ $string = str_replace(['"', $proxy], ['\\"', '"'], $string);
$string = "[" . rtrim($string, ",") . "]";
$json = json_decode($string, true);
@@ -527,7 +533,7 @@ elseif (str_ends_with($url["path"], "/log")) {
<td><?php echo $entry["commit"]; ?></td>
<td><?php echo $entry["author"]; ?></td>
<td><?php echo $entry["date"]; ?></td>
- <td><?php echo $entry["message"]; ?></td>
+ <td><?php echo nl2br($entry["message"]); ?></td>
</tr>
<?php
}