This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository fateserver.

commit 8a12667eba27e55be9b06143688decb60c2a0e6a
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Tue Aug 11 23:41:47 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Wed Aug 12 00:23:27 2026 +0200

    Link revisions to code.ffmpeg.org instead of gitweb
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 FATE.pm     | 29 +++++++++++++++++++++++++++--
 history.cgi |  4 ++--
 index.cgi   |  4 ++--
 report.cgi  | 15 ++++++---------
 4 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/FATE.pm b/FATE.pm
index d74fd00..d0f5508 100644
--- a/FATE.pm
+++ b/FATE.pm
@@ -35,7 +35,8 @@ BEGIN {
                   cgi_path_is_trustworthy
                   safeparam safeparam_opt
                   safeparam_sort safeparam_slot safeparam_time safeparam_log
-                  $fatedir $recent_age $ancient_age $hidden_age $gitweb/;
+                  rev_url compare_url
+                  $fatedir $recent_age $ancient_age $hidden_age/;
 }
 
 our $fatedir = "/var/www/fateweb";
@@ -43,7 +44,7 @@ our $recent_age  = 3600;
 our $ancient_age = 3 * 86400;
 our $hidden_age  = 30 * 86400;
 our $pretty_links = 0;
-our $gitweb = "https://git.ffmpeg.org/?p=ffmpeg.git";;
+our $gitrepo = "https://code.ffmpeg.org/FFmpeg/FFmpeg";;
 
 #require "$ENV{FATEWEB_CONFIG}";
 
@@ -185,6 +186,30 @@ sub load_lastpass {
     return \%lastpass;
 }
 
+# The hash in a revision as reported by clients. version.sh generates, in
+# order of preference: git describe output <tag>-<n>-g<hash> with the tag
+# name depending on the branch, a bare hash, git-<date>-<hash> in shallow
+# clones, and the RELEASE number with -<hash> appended for snapshots or
+# nothing linkable at all.
+sub rev_hash {
+    my ($rev) = @_;
+    return undef if not defined $rev;
+    return $1 if $rev =~ /-g([0-9a-f]{7,40})\b/;
+    return $1 if $rev =~ /(?:^|-)([0-9a-f]{7,40})\z/;
+    return undef;
+}
+
+sub rev_url {
+    my $hash = rev_hash $_[0];
+    return $gitrepo && $hash ? "$gitrepo/commit/$hash" : undef;
+}
+
+sub compare_url {
+    my $old = rev_hash $_[0];
+    my $new = rev_hash $_[1];
+    return $gitrepo && $old && $new ? "$gitrepo/compare/$old...$new" : undef;
+}
+
 sub parse_date {
     $_[0] =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ or return undef;
     mktime $6, $5, $4, $3, $2-1, $1-1900;
diff --git a/history.cgi b/history.cgi
index ea64375..2cf97c0 100755
--- a/history.cgi
+++ b/history.cgi
@@ -67,9 +67,9 @@ for my $i (0 .. $nshow - 1) {
 
     start 'tr', class => 'alt hilight';
     td agestr $age, $time;
-    if ($gitweb and $$rep{rev} =~ /(N-)?(.*)/) {
+    if (my $url = rev_url $$rep{rev}) {
         start 'td';
-        anchor $$rep{rev}, href => "$gitweb;a=commit;h=$2";
+        anchor $$rep{rev}, href => $url;
         end 'td';
     } else {
         td $$rep{rev};
diff --git a/index.cgi b/index.cgi
index 752e4ae..aecd434 100755
--- a/index.cgi
+++ b/index.cgi
@@ -274,9 +274,9 @@ for my $rep (sort repcmp @reps) {
     start 'td';
     anchor $agestr, href => href slot => $$rep{slot};
     end 'td';
-    if ($gitweb and $$rep{rev} =~ /(N-)?(.*)/) {
+    if (my $url = rev_url $$rep{rev}) {
         start 'td';
-        anchor $$rep{rev}, href => "$gitweb;a=commit;h=$2";
+        anchor $$rep{rev}, href => $url;
         end 'td';
     } else {
         td $$rep{rev};
diff --git a/report.cgi b/report.cgi
index 771d610..d7fcc3f 100755
--- a/report.cgi
+++ b/report.cgi
@@ -98,9 +98,9 @@ trow 'Configuration', '<code>' . $$conf{config} . '</code>';
 trow 'Comment',       $$hdr{comment};
 start 'tr';
 td   'Revision';
-if ($gitweb and $$hdr{rev} =~ /(N-)?(.*)/) {
+if (my $url = rev_url $$hdr{rev}) {
     start 'td';
-    anchor $$hdr{rev}, href => "$gitweb;a=commit;h=$2";
+    anchor $$hdr{rev}, href => $url;
     end 'td';
 } else {
     td $$hdr{rev};
@@ -163,19 +163,16 @@ if ($nfail) {
         td "stderr",  class => 'toggle', onclick => "show_err('$test')";
         td $test;
         td $$rec{status}, class => 'errcode';
-        if ($$lastpass{$n} and $gitweb) {
-            my ($old, $new);
-            $$lastpass{$n}{rev} =~ /(N-)?(.*)/ and $old = $2;
-            $$hdr{rev}          =~ /(N-)?(.*)/ and $new = $2;
-            if ($old and $new) {
+        if ($$lastpass{$n}) {
+            if (my $url = compare_url $$lastpass{$n}{rev}, $$hdr{rev}) {
                 start 'td';
-                anchor $$lastpass{$n}{rev}, href => 
"$gitweb;a=shortlog;h=$new;hp=$old";
+                anchor $$lastpass{$n}{rev}, href => $url;
                 end 'td';
             } else {
                 td $$lastpass{$n}{rev};
             }
         } else {
-            td $$lastpass{$n}? $$lastpass{$n}{rev} : 'n / a';
+            td 'n / a';
         }
         end 'tr';
         trowa { style => 'display: none' }, ''; # nee

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to