From: Jonas Fonseca <fonseca@diku•dk>
To: pasky@ucw•cz
Cc: git@vger•kernel.org
Subject: [PATCH] cg-mkpatch: Show human-readable dates
Date: Wed, 27 Apr 2005 01:27:29 +0200 [thread overview]
Message-ID: <20050426232729.GE28560@diku.dk> (raw)
Use the approach from from cg-log to show author and commit date
in a human-readable format.
Signed-off-by: Jonas Fonseca <fonseca@diku•dk>
---
commit e9f5d35741f92d64945a072759450b1c43b2b6e4
tree 01bda4c4ac0c3b938fb4e7954193f2441554acfb
parent e5eb91b0a47e1169006034af434312c7f38dc902
author Jonas Fonseca <fonseca@diku•dk> Wed, 27 Apr 2005 01:24:31 +0200
committer Jonas Fonseca <fonseca@diku•dk> Wed, 27 Apr 2005 01:24:31 +0200
cg-mkpatch | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
Index: cg-mkpatch
===================================================================
--- bd580d135661ff0bc8eb32cb36025cd1e7bdda13/cg-mkpatch (mode:100755 sha1:25c67a29296730daeac00e43fd4c18cf914a1c87)
+++ 01bda4c4ac0c3b938fb4e7954193f2441554acfb/cg-mkpatch (mode:100755 sha1:efee5dc887677d3122d8630b9ee3ef396b7adbd3)
@@ -12,15 +12,31 @@
showpatch () {
header=$(mktemp -t gitpatch.XXXXXX)
id=$1
- cat-file commit $id | while read line; do
- if [ ! "$line" ]; then
- cat
- echo
- echo ---
- echo commit $id
- cat $header
- fi
- echo $line >>$header
+ cat-file commit $id | while read key rest; do
+ case "$key" in
+ "author"|"committer")
+ date=(${rest#*> })
+ sec=${date[0]}; tz=${date[1]}
+ dtz=${tz/+/}
+ lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
+ pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
+ if [ "$pdate" ]; then
+ echo $key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/" >> $header
+ else
+ echo $key $rest >> $header
+ fi
+ ;;
+ "")
+ cat
+ echo
+ echo ---
+ echo commit $id
+ cat $header
+ ;;
+ *)
+ echo $key $rest >>$header
+ ;;
+ esac
done
echo
cg-diff -p -r $id > $header
--
Jonas Fonseca
next reply other threads:[~2005-04-26 23:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 23:27 Jonas Fonseca [this message]
2005-04-26 23:34 ` [PATCH] cg-mkpatch: Show human-readable dates Petr Baudis
2005-04-26 23:55 ` [PATCH] Move common date code to the library file Jonas Fonseca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050426232729.GE28560@diku.dk \
--to=fonseca@diku$(echo .)dk \
--cc=git@vger$(echo .)kernel.org \
--cc=pasky@ucw$(echo .)cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox