ikiwiki (3.20130711) unstable; urgency=low
[ikiwiki.git] / doc / bugs / Git:_changed_behavior_w.r.t._timestamps.mdwn
1 After some months, I just updated my local ikiwiki sources, and rebuilt
2 the Hurd web pages, <http://git.savannah.gnu.org/cgit/hurd/web.git/>.
3
4 I was confused, having switched to the new automatic (thanks!) --gettime
5 mechanism, why on some pages the timestamps had changed compared to my
6 previous use of --getctime and setting files' mtimes (using a script)
7 according to the last Git commit.  For example:
8
9 community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.html
10
11 old:
12
13     Last edited <span class="date">2008-09-11 18:11:53 UTC</span>
14     <!-- Created <span class="date">2008-09-11 17:47:08 UTC</span> -->
15
16 new:
17
18     Last edited <span class="date">2008-09-11 18:12:22 UTC</span>
19     <!-- Created <span class="date">2008-09-11 17:47:50 UTC</span> -->
20
21
22 I had a look at what git.pm is doing, and began to manually replay /
23 investigate:
24
25     $ git log --pretty=fuller --name-only --relative -- community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
26     commit 8f1b97bfe45b2f173e3a7d55dee226a9e289a695
27     Author:     arnebab <arne_bab@web.de>
28     AuthorDate: Thu Sep 11 20:11:53 2008 +0200
29     Commit:     arnebab <arne_bab@web.de>
30     CommitDate: Thu Sep 11 20:11:53 2008 +0200
31     
32         Added a link to the X.org guide in this wiki.
33     
34     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
35     
36     commit 3ef8b7d80d80572c436c4c60c71879bc74409816
37     Author:     arnebab <arne_bab@web.de>
38     AuthorDate: Thu Sep 11 19:47:08 2008 +0200
39     Commit:     arnebab <arne_bab@web.de>
40     CommitDate: Thu Sep 11 19:47:08 2008 +0200
41     
42         Minor update on the enty trying to get X working -> 'watch this place for updates'
43     
44     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
45
46 OK, these are my old dates.
47
48     $ git log --pretty=format:%ci --name-only --relative -- community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn 
49     2008-09-11 20:11:53 +0200
50     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
51     
52     2008-09-11 19:47:08 +0200
53     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
54     
55     $ git log --pretty=format:%ct --name-only --relative -- community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn 
56     1221156713
57     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
58     
59     1221155228
60     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
61     
62     $ date -d @1221156713
63     Thu Sep 11 18:11:53 UTC 2008
64     $ date -d @1221155228
65     Thu Sep 11 17:47:08 UTC 2008
66
67 That's all consistent.
68
69
70 But:
71
72     $ perl -le 'use Storable; my $index=Storable::retrieve("indexdb"); use Data::Dumper; print Dumper $index'
73     [...]
74                           'community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn' => {
75                                                                                         'ctime' => '1221155270',
76                                                                                         'dest' => [
77                                                                                                     'community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.html'
78                                                                                                   ],
79                                                                                         'typedlinks' => {
80                                                                                                           'tag' => {}
81                                                                                                         },
82                                                                                         'mtime' => 1221156742,
83                                                                                         'depends_simple' => {
84                                                                                                               'sidebar' => 1
85                                                                                                             },
86                                                                                         'links' => [
87                                                                                                      'community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x/discussion',
88                                                                                                      'Hurd/DebianXorg'
89                                                                                                    ],
90                                                                                         'state' => {
91     [...]
92
93     $ date -d @1221156742
94     Thu Sep 11 18:12:22 UTC 2008
95     $ date -d @1221155270
96     Thu Sep 11 17:47:50 UTC 2008
97
98 That's different, and it matches what the new ikiwiki writes into the
99 HTML file.
100
101
102 Back to Git again, this time without specifying the file:
103
104     $ git log --pretty=format:%ct --name-only --relative
105     [...]
106     1221255713
107     1221255655
108     unsorted/PortingIssues.mdwn
109     
110     1221156742 [Thu Sep 11 18:12:22 UTC 2008]
111     1221156713 [Thu Sep 11 18:11:53 UTC 2008]
112     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
113     
114     1221156267
115     1221156235
116     index.mdwn
117     
118     1221156122
119     1221156091
120     index.mdwn
121     
122     1221155942
123     1221155910
124     index.mdwn
125     
126     1221155270 [Thu Sep 11 17:47:50 UTC 2008]
127     1221155228 [Thu Sep 11 17:47:08 UTC 2008]
128     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
129     
130     1221154986
131     community/gsoc.mdwn
132     community/gsoc/project_ideas.mdwn
133     
134     1221147244
135     whatsnew.html
136     [...]
137
138 Aha!
139
140 ... and some more detail:
141
142     $ git log --pretty=fuller --name-only --relative
143     [...]
144     commit e4e89e1683012c879012522105a3471a00714613
145     Author:     Samuel Thibault <samuel.thibault@ens-lyon.org>
146     AuthorDate: Fri Sep 12 23:40:55 2008 +0200
147     Commit:     Samuel Thibault <samuel.thibault@ens-lyon.org>
148     CommitDate: Fri Sep 12 23:40:55 2008 +0200
149     
150         MSG_NOSIGNAL and IPV6_PKTINFO got fixed
151     
152     unsorted/PortingIssues.mdwn
153     
154     commit c389fae98dff86527be62f895ff7272e4ab1932c
155     Merge: 0339e3e 8f1b97b
156     Author:     GNU Hurd wiki engine <web-hurd@gnu.org>
157     AuthorDate: Thu Sep 11 18:12:22 2008 +0000
158     Commit:     GNU Hurd wiki engine <web-hurd@gnu.org>
159     CommitDate: Thu Sep 11 18:12:22 2008 +0000
160     
161         Merge branch 'master' of wiki@192.168.10.50:wiki
162     
163     commit 8f1b97bfe45b2f173e3a7d55dee226a9e289a695
164     Author:     arnebab <arne_bab@web.de>
165     AuthorDate: Thu Sep 11 20:11:53 2008 +0200
166     Commit:     arnebab <arne_bab@web.de>
167     CommitDate: Thu Sep 11 20:11:53 2008 +0200
168     
169         Added a link to the X.org guide in this wiki.
170     
171     community/weblogs/ArneBab/2008-08-02-gnu_hurd_and_x.mdwn
172     [...]
173
174 So, merges are involved there.
175
176 What (the new) ikiwiki code does, is use the timestamp when the merge was
177 done instead of the timestamp when the commit was done.  Is this
178 intentional?  Otherwise I could supply a patch.
179
180 --[[tschwinge]]
181
182 > In order to be nice and fast, the git backend runs git log once
183 > and records data for all files. Rather than looking at the log for a
184 > given file. So amoung other things, it does not follow renames.
185
186 > AFAICS, git log only shows merges modifying files if it was a conflicted
187 > merge. As the file is then actually modified to resolve the merge
188 > I think it makes sense to count the merge as the last modification in
189 > that case. --[[Joey]] 
190
191 >> That'd be reasonable, but `git log` will also show merges that are not
192 >> conflicting (as in my case).
193
194 >>> Actually when displaying a merge, `git log --stat` only lists files that
195 >>> were actually modified in a new way as part of the merge resolution.
196 >>> Ie, if the merge resolution only joins together some of the parent
197 >>> hunks, the file is not listed as having been modified.
198 >>>
199 >>> So, no, ikiwiki's use of git log will not show files modified in
200 >>> non-conflicting merges.
201 >>> --[[Joey]]
202
203 >> Yet, I'm not totally disagreeing with your choice.  With this `git
204 >> log` invocation, you're not able to tell from its output whether a
205 >> conflict was resolved or not.
206
207 >> Also, it's a bit like the *should we use the **author timestamp** or
208 >> **commit timestamp*** discussion.  Your code will always use the
209 >> latest timestamp.
210
211 >> I guess I'll get my head wrapped around that, and it's fine, so this is
212 >> [[done]].
213
214 >> --[[tschwinge]]