[web-doc] master: Show actual hash on diff output
| From: | alfsb via Nilgün Belma Bugüner | Date: | Sat, 15 Oct 2022 07:58:40 +0000 |
| Subject: | [web-doc] master: Show actual hash on diff output | ||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-2512@lists.php.net to get a copy of this message | ||
Author: alfsb (alfsb)
Committer: Nilgün Belma Bugüner (nilgun)
Date: 2022-10-15T10:48:37+03:00
Commit: https://github.com/php/web-doc/commit/27bc12bed0e56c45ca7eeb49dfc59b0d0be6c16e
Raw diff: https://github.com/php/web-doc/commit/27bc12bed0e56c45ca7eeb49dfc59b0d0be6c16e.diff
Show actual hash on diff output
. Thanks. Closes GH-38
Changed paths:
M include/lib_revcheck.inc.php
Diff:
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 0ff14fc..745df8f 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -253,6 +253,7 @@ function showdiff ()
$arg_h = escapeshellarg($h);
$arg_f = escapeshellarg($gitfile);
$file =
git diff {$arg_h} -- {$arg_f};
+ $hash = git log -n 1 --pretty=format:%H -- {$arg_f};
chdir( $cwd );
if (!$file) return;
$raw = htmlspecialchars( $file, ENT_XML1, 'UTF-8' );
@@ -280,7 +281,7 @@ function showdiff ()
$tagAccentBg = 'background-color: #d4d8e7;';
}
- echo "<div style='padding: 12px;'>$gitfile</div>";
+ echo "<div style='padding:
12px;'>$gitfile<br/>$hash</div>";
// Count how many lines to skip diff header
$diffStartLine = substr_count($raw, "\n", 0, strpos($raw, " @@"));