Package: ikiwiki
Version: 3.20101023
Severity: minor

Hi,

Git stores two different timestamps: commiter date and author date. Committer
date represents time of each commit and author date represents the original
date of the commit. Usually these two dates are the same. However, they might
differ if history of the repository is altered using "git rebase". After the
rebase point, all consecutive commits will get the current date as the
committer date.

How this affects IkiWiki? Well, currently if using git as RCS backend, IkiWiki
uses the committer date as the timestamp for files. If rebasing happens in the
IkiWiki repo, all files after the rebase point will get their ctime timestamp
to be the date when rebasing occurred. And thus e.g. the last change
information printed at the bottom of each page in the default template is lost.
This is wrong since the content of the commits remain unchanged. The author
date should be used instead, as it remains static even when the original commit
that brought in the change to content gets re-written. Author date always shows
when the content of a file was changed, and that's what IkiWiki should be
concerned, not the commit date. Default "git log" and "git whatchanged" outputs
also display just the author date, not commit date of files. Also it looks like
that author date is correctly used already in the code dealing with
recentchanges stuff in the Git plugin.

This change is very simple to do, just change the log format pattern to use %at
instead of %ct. Patch included. Thanks.
>From 5c8451fc9b70f3651e805ff082abfe718b81767f Mon Sep 17 00:00:00 2001
From: Tuomas Jormola <t...@solitudo.net>
Date: Sun, 31 Oct 2010 19:53:06 +0200
Subject: Use author date instead of commit date


Signed-off-by: Tuomas Jormola <t...@solitudo.net>
---
 IkiWiki/Plugin/git.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index f5101d9..3fa29b2 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -688,7 +688,7 @@ sub findtimes ($$) {
        if (! keys %time_cache) {
                my $date;
                foreach my $line (run_or_die('git', 'log',
-                               '--pretty=format:%ct',
+                               '--pretty=format:%at',
                                '--name-only', '--relative')) {
                        if (! defined $date && $line =~ /^(\d+)$/) {
                                $date=$line;
-- 
1.7.0.4

Reply via email to