From e36215f2be80fccf2158f09279f2ea4d8242da31 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 23 Oct 2014 00:05:57 -0400 Subject: [PATCH] git-rewrite-authors: use plain shell to speed up --- .bin/git-rewrite-authors | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.bin/git-rewrite-authors b/.bin/git-rewrite-authors index e5d4b08..e136e59 100755 --- a/.bin/git-rewrite-authors +++ b/.bin/git-rewrite-authors @@ -1,6 +1,7 @@ -#!/bin/bash +#!/bin/sh -tmp=$(mktemp) +tmp=$(mktemp -t "${0##*/}.XXXXXX") +trap "rm -rf '${tmp}'" EXIT cat << \EOF > ${tmp} decode() { awk -vid="$1" -vtype="$2" '$1 == id { @@ -9,18 +10,20 @@ decode() { email = a[2]; print "export GIT_"type"_NAME='\''" name "'\'';" print "export GIT_"type"_EMAIL='\''" email "'\'';" - }' ${author_file} + }' "${author_file}" } EOF for x in cvs-authors authors ; do - export author_file=${PWD}/.git/$x - [ -e ${author_file} ] && break + export author_file="${PWD}/.git/${x}" + [ -e "${author_file}" ] && break + if [ -L "${author_file}" ] ; then + echo "error: ${author_file} is a broken link" + exit 1 + fi done git filter-branch \ --env-filter ". ${tmp};"' \ eval `decode "${GIT_AUTHOR_NAME}" AUTHOR`; \ eval `decode "${GIT_COMMITTER_NAME}" COMMITTER`; \ ' "$@" - -rm -f $tmp -- 2.39.5