change temp email var to subshell

This commit is contained in:
wangzengdi 2016-09-13 10:30:28 +08:00
commit 77e96ce382

View file

@ -34,18 +34,14 @@ function work_in_progress() {
} }
#change current branch old email with new eamil #change current branch old email with new eamil
gmvemail() { gmvemail() {
export GMVEMAIL_GIT_EMAIL_OLD=$1 OLD_EMAIL=$1 NEW_EMAIL=$2 git filter-branch --commit-filter '
export GMVEMAIL_GIT_EMAIL_NEW=$2 if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ];
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "$GMVEMAIL_GIT_EMAIL_OLD" ];
then then
GIT_AUTHOR_EMAIL="$GMVEMAIL_GIT_EMAIL_NEW"; GIT_AUTHOR_EMAIL="$NEW_EMAIL";
git commit-tree "$@"; git commit-tree "$@";
else else
git commit-tree "$@"; git commit-tree "$@";
fi' HEAD fi' HEAD
unset GMVEMAIL_GIT_EMAIL_OLD
unset GMVEMAIL_GIT_EMAIL_NEW
git update-ref -d refs/original/refs/heads/$(git symbolic-ref --short HEAD) git update-ref -d refs/original/refs/heads/$(git symbolic-ref --short HEAD)
} }