#!/bin/bash ###################################################################### # okiniri-export # # Given a patchset, get the log, diffstat and diff # # (C) 2005 Horms # a.k.a Simon Horman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA ###################################################################### set -e if [ $# -ne 1 ]; then echo "Usage: okiniri-export |HEAD" >&2 exit 1 fi COMMIT="$(git-rev-parse --revs-only --no-flags --default $1)" #LC_ALL=C date -d "@1141975489" "+%c %z" echo "commit $COMMIT" git cat-file commit "$COMMIT" | while IFS=\> read a b; do if [ -n "$b" ]; then echo -n "$a> " SEC=${b#* } SEC=${SEC% *} ZONE=${b##* } SIGN=${ZONE%%[0-9]*} OFFSET=${ZONE#$SIGN} HOURS=${OFFSET%??} MINUTES=${OFFSET#??} if [ "$SIGN" = "+" ]; then SIGN="-" else SIGN="+" fi TZ="UTC ${SIGN}$HOURS:$MINUTES" LC_ALL=C \ date -d "@$SEC" "+%c %z" else echo "$a" fi done echo git diff-tree -p "$COMMIT" | diffstat -p1 echo git diff-tree -p "$COMMIT"