]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/use_of___36__topurl_in_cgitemplate.mdwn
cgitemplate: remove dead code
[git.ikiwiki.info.git] / doc / bugs / use_of___36__topurl_in_cgitemplate.mdwn
1 In commits by Simon McVittie on Oct 5, 2014, the following was added to `cgitemplate()`:
3     b0a35c81 (Simon McVittie   2014-10-05  61)  my $topurl = $config{url};
4     3b8da667 (Simon McVittie   2014-10-05  62)  if (defined $cgi && ! $config{w3mmode} && ! $config{reverse_proxy}) {
5     b0a35c81 (Simon McVittie   2014-10-05  63)          $topurl = $cgi->url;
6     b0a35c81 (Simon McVittie   2014-10-05  64)  }
8 I am trying to determine what was intended by this change.  The variable `$topurl` is not used again in this function, so this is essentially dead code.
9 --[[blipvert]]
11 > If you look at `git log -p IkiWiki/CGI.pm` you'll see that *at the time*, `$topurl`
12 > was used further down the function. Later in the branch, [commit 33f6026
13 "In html5 mode, generate a host- or protocol-relative <base> for the
14 CGI"](http://source.ikiwiki.branchable.com/?p=source.git;a=commit;h=33f60260b233d0310ce6dd4304304a516595b906)
15 > made this conditional on `! $config{html5}`.
16 >
17 > Somewhat later,
18 > [commit 490a1ec
19 "Always produce HTML5 doctype and new attributes, but not new
20 elements"](http://source.ikiwiki.branchable.com/?p=source.git;a=commit;h=490a1eca7bed841848765b495a73fbc56e4808f4)
21 > repurposed `$config{html5}` from "use HTML5" to "use new HTML5 elements" -
22 > which meant that [commit a052771
23 "Now that we're always using HTML5, <base href> can be
24 relative"](http://source.ikiwiki.branchable.com/?p=source.git;a=commit;h=a05277128732beb351aa696c49d337086414ffb6)
25 > could remove the only code that used `$topurl`.
26 >
27 > You are correct to say that computing `$topurl` is now dead code, and I
28 > have removed it. [[done]] --[[smcv]]