Skip to contentSkip to conversation

from line script for git commits

DISCUSSION James Cloos 2 participants 2 messages Apr 21, 2005 – May 5, 2005

lore
Share & tools
lore
#0 lore raw

I've been using a script grabbed from here for some time to alter the From: line on mail sent to bk-head-commits and bk-24-commits to show the author's name and email rather than LKML's address.

Below is my script for doing the same with git commit emails.

-JimC

#1 lore raw
Quoted 5 lines · James Cloos

I've been using a script grabbed from here for some time to alter the From: line on mail sent to bk-head-commits and bk-24-commits to show the author's name and email rather than LKML's address.

Below is my script for doing the same with git commit emails.

Ages ago I grabbed a different one for fixing up BK. Here's what I've got now that fixes up both (and munges the date on git, which may or may not turn out to be useful).

#!/bin/sh

TMP=mktemp /tmp/setfrom.XXXXXX
cat > $TMP

## Old BitKeeper logic
from=grep '^ChangeSet' $TMP | head -1 | awk '{print $NF}'

## New git logic
author=sed -n '/^author /p' < $TMP | head -n 1
if [ ! -z "$author" ]; then
from=echo $author | sed 's/author \(.*>\).*/\1/' date=echo $author | sed 's/author.*> //'
fi
if test -n "$from" -a -n "$date"; then
formail -I "From: $from" -I "Date: date -d "$date" -R" < $TMP
else
if test -n "$from"; then
formail -I "From: $from" < $TMP
else
cat $TMP
fi
fi

rm $TMP

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/