{"thread":{"id":"881","subject":"[PATCH 3/6] Make showdate use \"Linus format\"","startedAt":"2005-06-09T11:19:30Z","lastAt":"2005-06-11T08:28:56Z","messageCount":3,"participants":["Dan Holmsand","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"4780","messageId":"42A825C2.1060302@gmail.com","threadId":"881","inReplyTo":null,"subject":"[PATCH 3/6] Make showdate use \"Linus format\"","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-09T11:19:30Z","receivedAt":"2005-06-09T11:19:30Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"This makes showdate use the same date format as\ngit-rev-list --pretty, and gives some speedup. It might also\nbe more portable.\n\nNote that this changes the calling convention: the previous\nversion used seconds from $1, but timezone from the global\nvariable $date. cg-mkpatch is modified to the new way.\n\nAlso fixes bash's belief that number literals starting with\nzero are octal.\n\nSigned-off-by: Dan Holmsand <holmsand@gmail.com>\n---\n\n\n cg-Xlib    |   18 ++++++++----------\n cg-mkpatch |    2 +-\n 2 files changed, 9 insertions(+), 11 deletions(-)\n\ndiff --git a/cg-Xlib b/cg-Xlib\n--- a/cg-Xlib\n+++ b/cg-Xlib\n@@ -60,19 +60,17 @@ stat () {\n }\n \n showdate () {\n-\tdate=\"$1\"\n-\tformat=\"$2\"\n-\t[ \"$format\" ] || format=-R\n-\tsec=${date[0]}; tz=${date[1]}\n+\tlocal secs=$1 tzhours=${2:0:3} tzmins=${2:0:1}${2:3} format=$3\n+\t# bash doesn't like leading zeros\n+\t[ \"${tzhours:1:1}\" = 0 ] && tzhours=${2:0:1}${2:2:1}\n+\tsecs=$((secs + tzhours * 3600 + tzmins * 60))\n \tif [ \"$has_gnudate\" ]; then\n-\t        dtz=${tz/+/}\n-\t\tlsec=$(($dtz / 100 * 3600 + $dtz % 100 * 60 + $sec))\n-\t        pdate=\"$(date -ud \"1970-01-01 UTC + $lsec sec\" \"$format\" 2>/dev/null)\"\n+\t\t[ \"$format\" ] || format=\"+%a %b %-d %H:%M:%S %Y $2\"\n+\t\tLANG=C date -ud \"1970-01-01 UTC + $secs sec\" \"$format\"\n \telse\n-\t\t# FIXME: $format\n-\t        pdate=\"$(date -u -r ${date[0]} 2>/dev/null)\"\n+\t\t[ \"$format\" ] || format=\"+%a %b %d %H:%M:%S %Y $2\"\n+\t\tdate -u -r $secs \"$format\"\n \tfi\n-\techo \"${pdate/+0000/$tz}\"\n }\n \n # Usage: tree_timewarp [--no-head-update] DIRECTION_STR ROLLBACK_BOOL BASE BRANCH\ndiff --git a/cg-mkpatch b/cg-mkpatch\n--- a/cg-mkpatch\n+++ b/cg-mkpatch\n@@ -52,7 +52,7 @@ showpatch () {\n \t\tcase \"$key\" in\n \t\t\"author\"|\"committer\")\n \t\t\tdate=(${rest#*> })\n-\t\t\tpdate=\"$(showdate $date)\"\n+\t\t\tpdate=\"$(showdate ${date[*]})\"\n \t\t\t[ \"$pdate\" ] && rest=\"${rest%> *}> $pdate\"\n \t\t\techo $key $rest >>$header\n \t\t\t;;\n"},{"id":"4837","messageId":"20050610225938.GE22111@pasky.ji.cz","threadId":"881","inReplyTo":"42A825C2.1060302@gmail.com","subject":"Re: [PATCH 3/6] Make showdate use \"Linus format\"","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-10T22:59:38Z","receivedAt":"2005-06-10T22:59:38Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Thanks, applied.\n\nDear diary, on Thu, Jun 09, 2005 at 01:19:30PM CEST, I got a letter\nwhere Dan Holmsand <holmsand@gmail.com> told me that...\n> This makes showdate use the same date format as\n> git-rev-list --pretty, and gives some speedup. It might also\n> be more portable.\n\nI dropped the format change bit, because I really think the Linus' date\nformat is bad. The current standardized, international and most widely\nused (even your mailer agent used it in your Date: header) date format\nis RFC 822, so please let's stick with it. It's perfect for our use, and\nbetter human-readable too. The date part isn't split all around but\nconcentrated in the first half while the second half is dedicated to\ntime.\n\n> Note that this changes the calling convention: the previous\n> version used seconds from $1, but timezone from the global\n> variable $date. cg-mkpatch is modified to the new way.\n\nYou forgot to modify cg-log accordingly. (I fixed that.)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n<Espy> be careful, some twit might quote you out of context..\n"},{"id":"4865","messageId":"42AAA0C8.9020102@gmail.com","threadId":"881","inReplyTo":"20050610225938.GE22111@pasky.ji.cz","subject":"Re: [PATCH 3/6] Make showdate use \"Linus format\"","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-11T08:28:56Z","receivedAt":"2005-06-11T08:28:56Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"Petr Baudis wrote:\n> Thanks, applied.\n> \n> Dear diary, on Thu, Jun 09, 2005 at 01:19:30PM CEST, I got a letter\n> where Dan Holmsand <holmsand@gmail.com> told me that...\n> \n>>This makes showdate use the same date format as\n>>git-rev-list --pretty, and gives some speedup. It might also\n>>be more portable.\n> \n> \n> I dropped the format change bit, because I really think the Linus' date\n> format is bad. The current standardized, international and most widely\n> used (even your mailer agent used it in your Date: header) date format\n> is RFC 822, so please let's stick with it. It's perfect for our use, and\n> better human-readable too. The date part isn't split all around but\n> concentrated in the first half while the second half is dedicated to\n> time.\n\nOk, I really have nothing against RFC822. But if Linus' format is bad, \nthen git-rev-list --pretty should be fixed (or, rather, date.c). It \ndoesn't make any sense to me to have different formats between cogito \nand core git.\n\nAnd I'd really, really like to use as much of git-rev-list --pretty \noutput as possible in cg-log. That makes the whole thing some orders of \nmagnitude faster, and thus more usable.\n\n>>Note that this changes the calling convention: the previous\n>>version used seconds from $1, but timezone from the global\n>>variable $date. cg-mkpatch is modified to the new way.\n> \n> \n> You forgot to modify cg-log accordingly. (I fixed that.)\n\nThanks. I did the \"hope he takes my other patch too\" thing... Sorry \n'bout that.\n\n/dan\n"}]}