1.remove $BRANCH_NAME; 2.change email temp name to avoid wrongly changed env var

This commit is contained in:
wangzengdi 2016-09-11 23:45:25 +08:00
commit 6f5a9d57ae

View file

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