git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3 (alternate)] gitweb: Mark "atnight" author/committer times also for 'localtime'

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 19, 2011, 01:25 UTC
Message-ID
<7vaagrsxyk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201103182328.19141.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 35 quoted lines
> Junio C Hamano wrote:
> ...
>> and format_timestamp would be like
>> 
>> 	sub format_timestamp {
>> 		my %date = %$_[0];
>>       	my $use_localtime = $_[1];
>> 		my $localtime, $ret, $nite;
>> 
>> 		$nite = ($date{'hour_local'} < 6);
>> 
>> 		if ($use_localtime) {
>> 			$ret = $date{'rfc2822_local'};
>>       		if ($nite) {
>>                         	$ret = sprintf("<span class='atnight'>%s</span>", $ret);
>> 			}
>> 		} else {
>> 			... what the current format_local_time does to set
>> 	        	... including the spanning part
>>               	$ret = "$date{'rfc2822'} ($localtime)";
>> 		}
>> 		return $ret;
>> 	}
>
> Well, if we go this route, and assuming that parse_date does only parsing
> and we use separate subroutine for generating date in an rfc2822 format,
> then we could mark only time with "atnight" also when 'localtime' feature
> is enabled.
>  
>> Wouldn't it be much cleaner?  You can then clean up the other call site of
>> print_local_time in git_print_authorship using the same helper function
>> (presumably you would always pass 0 to $use_localtime there), no?
>
> Right.  Well, I'd have to think a bit about API for format_timestamp,
> but it looks like good direction.

I don't think there is much to think about for format_timestamp, as I was suggesting to keep what comes in %date more or less the same as what the current parse_date() generates. I was only hinting that parse_date() is misnamed.

Previous: Jakub NarebskiNext: Jakub Narebski
Message 12 of 17 in “gitweb: fix #patchNN anchors when path_info is enabled”
  1. 1/3 gitweb: fix #patchNN anchors when path_info is enabledKevin Cernekee, Mar 17, 2011
  2. 2/3 gitweb: introduce localtime featureKevin Cernekee, Mar 17, 2011
  3. 2/3 gitweb: introduce localtime featureJakub Narebski, Mar 18, 2011
  4. Junio C HamanoMar 18, 2011
  5. Jakub NarebskiMar 18, 2011
  6. Junio C HamanoMar 18, 2011
  7. 3/3 gitweb: show alternate author/committer timesKevin Cernekee, Mar 17, 2011
  8. 3/3 gitweb: Mark "atnight" author/committer times also for 'localtime'Jakub Narebski, Mar 18, 2011
  9. Kevin CernekeeMar 18, 2011
  10. Junio C HamanoMar 18, 2011
  11. Jakub NarebskiMar 18, 2011
  12. Junio C HamanoMar 19, 2011
  13. 1/3 gitweb: fix #patchNN anchors when path_info is enabledJakub Narebski, Mar 18, 2011
  14. Kevin CernekeeMar 18, 2011
  15. 1/3 gitweb: fix #patchNN anchors when path_info is enabledJakub Narebski, Mar 18, 2011
  16. Junio C HamanoMar 18, 2011
  17. Jakub NarebskiMar 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.