From df99eafd5164abb16373a5b85f338b68cd7a6bc2 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 1 May 2017 16:44:00 +0200 Subject: [PATCH] added two shell scripts to fix Git history --- tools/fix_git_history.sh | 146 +++++++++++++++++++++++++++++++++++++++ tools/remove_lgpl.sh | 34 +++++++++ 2 files changed, 180 insertions(+) create mode 100755 tools/fix_git_history.sh create mode 100755 tools/remove_lgpl.sh diff --git a/tools/fix_git_history.sh b/tools/fix_git_history.sh new file mode 100755 index 000000000..ea94c0690 --- /dev/null +++ b/tools/fix_git_history.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# Rewrite Git history +# +# @author Steffen Vogel +# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# 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 3 of the License, or +# 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, see . +################################################################################### + +#git filter-branch --tree-filter "find . -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'" -- --all + +#git filter-branch \ +# --index-filter 'git rm --cached --ignore-unmatch COPYING' \ +# --index-filter 'git rm --cached --ignore-unmatch COPYING.md' \ +# --index-filter 'git rm --cached --ignore-unmatch LICENSE' \ +# --index-filter 'git rm --cached --ignore-unmatch LICENSE.md' -- --all + +git filter-branch --force --prune-empty \ + --tag-name-filter cat \ + --index-filter 'git rm --cached --ignore-unmatch COPYING.md' \ + --tree-filter ~/workspace/rwth/villas/remove_lgpl.sh \ + --env-filter ' +CORRECT_NAME="Steffen Vogel" +CORRECT_EMAIL="stvogel@eonerc.rwth-aachen.de" + +OLD_EMAIL="noreply@github.com" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="StVogel@eonerc.rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="steffen.vogel@rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="post@steffenvogel.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +CORRECT_NAME="Umar Farooq" +CORRECT_EMAIL="ufarooq@eonerc.rwth-aachen.de" + +OLD_EMAIL="UFarooq@eonerc.rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="umar.farooq@rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +CORRECT_NAME="Marija Stevic" +CORRECT_EMAIL="mstevic@eonerc.rwth-aachen.de" + +OLD_EMAIL="mstevic@users.noreply.github.com" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="marija.stevic@eonerc.rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="msv@E098.eonerc.rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi + +OLD_EMAIL="msv@E250.eonerc.rwth-aachen.de" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi +' -- --all \ No newline at end of file diff --git a/tools/remove_lgpl.sh b/tools/remove_lgpl.sh new file mode 100755 index 000000000..c36a799eb --- /dev/null +++ b/tools/remove_lgpl.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Remove LGPL licence from all files +# +# @author Steffen Vogel +# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# 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 3 of the License, or +# 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, see . +################################################################################### + +#sed -i -e '/@license GNU Lesser General Public License/d' \ +# -e '/This application is free software;/,+12d' \ +# -e '/ * VILLASnode - connecting real-time simulation equipment/,+1d' $1 + +find . \( -name "*.c" -or -name "*.h" -or -name "Dockerfile*" -or -name "Makefile*" -or -name "*.conf" -or -name "*.sh" -or -name "*.js" \) \ + -not -path thirdparty \ + -not -path build \ + -exec test -e {} \; \ + -print0 | xargs -0 \ + sed -i -e '/@license GNU Lesser General Public License v2.1/,/Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA/d'