如何在gitweb上禁用相对日期显示?

时间:2013-04-29 09:19:28

标签: git gitweb git-config

如何阻止gitweb显示相关的所有日期,例如:3天前,2周前,3天前,11天前,21小时前?当我想要浏览并查看某个日期周围的变化时,如果它们都是相对的,那就非常烦人了。

1 个答案:

答案 0 :(得分:0)

我发现的唯一方法是黑客攻击源:

--- gitweb.cgi.orig     2015-05-05 16:19:45.341774512 +0200
+++ gitweb.cgi  2015-05-05 16:22:53.437428996 +0200
@@ -3518,13 +3518,14 @@
        $co{'age'} = $age;
        $co{'age_string'} = age_string($age);
        my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($co{'committer_epoch'});
-       if ($age > 60*60*24*7*2) {
-               $co{'age_string_date'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
-               $co{'age_string_age'} = $co{'age_string'};
-       } else {
-               $co{'age_string_date'} = $co{'age_string'};
-               $co{'age_string_age'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
-       }
+# never use relative dates
+#      if ($age > 60*60*24*7*2) {
+       $co{'age_string_date'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
+       $co{'age_string_age'} = $co{'age_string'};
+#      } else {
+#              $co{'age_string_date'} = $co{'age_string'};
+#              $co{'age_string_age'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
+#      }
        return %co;
 }