{"thread":{"id":"343","subject":"[PATCH] cg-mkpatch: Show human-readable dates","startedAt":"2005-04-26T23:27:29Z","lastAt":"2005-04-26T23:55:32Z","messageCount":3,"participants":["Jonas Fonseca","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1827","messageId":"20050426232729.GE28560@diku.dk","threadId":"343","inReplyTo":null,"subject":"[PATCH] cg-mkpatch: Show human-readable dates","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-04-26T23:27:29Z","receivedAt":"2005-04-26T23:27:29Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Use the approach from from cg-log to show author and commit date\nin a human-readable format.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\ncommit e9f5d35741f92d64945a072759450b1c43b2b6e4\ntree 01bda4c4ac0c3b938fb4e7954193f2441554acfb\nparent e5eb91b0a47e1169006034af434312c7f38dc902\nauthor Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:24:31 +0200\ncommitter Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:24:31 +0200\n\n cg-mkpatch |   34 +++++++++++++++++++++++++---------\n 1 files changed, 25 insertions(+), 9 deletions(-)\n\nIndex: cg-mkpatch\n===================================================================\n--- bd580d135661ff0bc8eb32cb36025cd1e7bdda13/cg-mkpatch  (mode:100755 sha1:25c67a29296730daeac00e43fd4c18cf914a1c87)\n+++ 01bda4c4ac0c3b938fb4e7954193f2441554acfb/cg-mkpatch  (mode:100755 sha1:efee5dc887677d3122d8630b9ee3ef396b7adbd3)\n@@ -12,15 +12,31 @@\n showpatch () {\n \theader=$(mktemp -t gitpatch.XXXXXX)\n \tid=$1\n-\tcat-file commit $id | while read line; do\n-\t\tif [ ! \"$line\" ]; then\n-\t\t\tcat\n-\t\t\techo\n-\t\t\techo ---\n-\t\t\techo commit $id\n-\t\t\tcat $header\n-\t\tfi\n-\t\techo $line >>$header\n+\tcat-file commit $id | while read key rest; do\n+\t\tcase \"$key\" in\n+\t\t\"author\"|\"committer\")\n+\t\t\tdate=(${rest#*> })\n+\t\t\tsec=${date[0]}; tz=${date[1]}\n+\t\t\tdtz=${tz/+/}\n+\t\t\tlsec=$(expr $dtz / 100 \\* 3600 + $dtz % 100 \\* 60 + $sec)\n+\t\t\tpdate=\"$(date -Rud \"1970-01-01 UTC + $lsec sec\" 2>/dev/null)\"\n+\t\t\tif [ \"$pdate\" ]; then\n+\t\t\t\techo $key $rest | sed \"s/>.*/> ${pdate/+0000/$tz}/\" >> $header\n+\t\t\telse\n+\t\t\t\techo $key $rest >> $header\n+\t\t\tfi\n+\t\t\t;;\n+\t\t\"\")\n+\t\t\tcat\n+\t\t\techo\n+\t\t\techo ---\n+\t\t\techo commit $id\n+\t\t\tcat $header\n+\t\t\t;;\n+\t\t*)\n+\t\t\techo $key $rest >>$header\n+\t\t\t;;\n+\t\tesac\n \tdone\n \techo\n \tcg-diff -p -r $id > $header\n\n-- \nJonas Fonseca\n"},{"id":"1828","messageId":"20050426233439.GS13224@pasky.ji.cz","threadId":"343","inReplyTo":"20050426232729.GE28560@diku.dk","subject":"Re: [PATCH] cg-mkpatch: Show human-readable dates","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-26T23:34:39Z","receivedAt":"2005-04-26T23:34:39Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Apr 27, 2005 at 01:27:29AM CEST, I got a letter\nwhere Jonas Fonseca <fonseca@diku.dk> told me that...\n> Use the approach from from cg-log to show author and commit date\n> in a human-readable format.\n> \n> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n\nThat means you want this in the library. ;-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1832","messageId":"20050426235532.GF28560@diku.dk","threadId":"343","inReplyTo":"20050426233439.GS13224@pasky.ji.cz","subject":"[PATCH] Move common date code to the library file","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-04-26T23:55:32Z","receivedAt":"2005-04-26T23:55:32Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Move common date conversion code to showdate() library function.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\ncommit e7ab52f0d69a45e69d78f2992c7997283855ac48\ntree 01c206a9520ffa599c3ce17c901b4fce9b162b08\nparent 09da825be78580e991bfd0ccbb90de15bfa18113\nauthor Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:53:04 +0200\ncommitter Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:53:04 +0200\n\n cg-Xlib    |    9 +++++++++\n cg-log     |    7 ++-----\n cg-mkpatch |    7 ++-----\n 3 files changed, 13 insertions(+), 10 deletions(-)\n\nIndex: cg-Xlib\n===================================================================\n--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-Xlib  (mode:100755 sha1:5d84bbdb19510b7399f39ffd920636821a37248c)\n+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-Xlib  (mode:100755 sha1:665b84360050e7151eb2aa34327a10821ddc9ccf)\n@@ -33,6 +33,15 @@\n \t$(which mktemp) $dirarg $prefix\"$1\"\n }\n \n+showdate () {\n+\tdate=\"$1\"\n+\tsec=${date[0]}; tz=${date[1]}\n+\tdtz=${tz/+/}\n+\tlsec=$(expr $dtz / 100 \\* 3600 + $dtz % 100 \\* 60 + $sec)\n+\tpdate=\"$(date -Rud \"1970-01-01 UTC + $lsec sec\" 2>/dev/null)\"\n+\n+\techo \"${pdate/+0000/$tz}\"\n+}\n \n # Compatibility hacks:\n # 2005-04-26\nIndex: cg-log\n===================================================================\n--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-log  (mode:100755 sha1:1c53b31a956e7c8cbfe653143cc0f91df02a2f86)\n+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-log  (mode:100755 sha1:5d0b602d32068af0d6e958f1c9c4dd6c870a9ce1)\n@@ -96,12 +96,9 @@\n \t\t\t\tfi\n \n \t\t\t\tdate=(${rest#*> })\n-\t\t\t\tsec=${date[0]}; tz=${date[1]}\n-\t\t\t\tdtz=${tz/+/}\n-\t\t\t\tlsec=$(expr $dtz / 100 \\* 3600 + $dtz % 100 \\* 60 + $sec)\n-\t\t\t\tpdate=\"$(date -Rud \"1970-01-01 UTC + $lsec sec\" 2>/dev/null)\"\n+\t\t\t\tpdate=\"$(showdate $date)\"\n \t\t\t\tif [ \"$pdate\" ]; then\n-\t\t\t\t\techo -n $color$key $rest | sed \"s/>.*/> ${pdate/+0000/$tz}/\"\n+\t\t\t\t\techo -n $color$key $rest | sed \"s/>.*/> $pdate/\"\n \t\t\t\t\techo $coldefault\n \t\t\t\telse\n \t\t\t\t\techo $color$key $rest $coldefault\nIndex: cg-mkpatch\n===================================================================\n--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-mkpatch  (mode:100755 sha1:efee5dc887677d3122d8630b9ee3ef396b7adbd3)\n+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-mkpatch  (mode:100755 sha1:c6aa52b6c773718a64feef47a165885b684b593b)\n@@ -16,12 +16,9 @@\n \t\tcase \"$key\" in\n \t\t\t\"author\"|\"committer\")\n \t\t\t\tdate=(${rest#*> })\n-\t\t\t\tsec=${date[0]}; tz=${date[1]}\n-\t\t\t\tdtz=${tz/+/}\n-\t\t\t\tlsec=$(expr $dtz / 100 \\* 3600 + $dtz % 100 \\* 60 + $sec)\n-\t\t\t\tpdate=\"$(date -Rud \"1970-01-01 UTC + $lsec sec\" 2>/dev/null)\"\n+\t\t\t\tpdate=\"$(showdate $date)\"\n \t\t\t\tif [ \"$pdate\" ]; then\n-\t\t\t\t\techo $key $rest | sed \"s/>.*/> ${pdate/+0000/$tz}/\" >> $header\n+\t\t\t\t\techo $key $rest | sed \"s/>.*/> $pdate/\" >> $header\n \t\t\t\telse\n \t\t\t\t\techo $key $rest >> $header\n \t\t\t\tfi\n\n-- \nJonas Fonseca\n"}]}