aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2014-08-14 10:17:26 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-03-01 01:24:18 +0100
commit74b69f3014210c980a1ea3bfe44831fbbfa682ad (patch)
treebc01c4036b90aa78c2d50575a6c834837b75af2f
parent53a8fe1e9513d9116cd8ee99129041dfa111d9b9 (diff)
downloadhlupak-74b69f3014210c980a1ea3bfe44831fbbfa682ad.tar.gz
fix(git-svn-fix-authors): Various cleanups
-rwxr-xr-xgit-svn-fix-authors.sh41
1 files changed, 34 insertions, 7 deletions
diff --git a/git-svn-fix-authors.sh b/git-svn-fix-authors.sh
index 16acdf4..7b46ef4 100755
--- a/git-svn-fix-authors.sh
+++ b/git-svn-fix-authors.sh
@@ -1,13 +1,14 @@
#!/bin/sh
set -eu
-AUTHORS_FILE=$(git config svn.authorsfile) || {
+AUTHORS_FILE=$(git config svn.authorsfile) || \
+ AUTHORS_FILE=$(git config svn-remote.svn.authorsfile) || {
echo "ERROR: set config.svn.authorsfile!"
exit 128
}
export AUTHORS_FILE=$(readlink -f $AUTHORS_FILE)
-git filter-branch --env-filter '
+git filter-branch -f --tag-name-filter cat --env-filter '
function replacement() {
REPL=$(awk -F"[[:space:]]*=[[:space:]]*" "/$1/ {print \$2}" $AUTHORS_FILE)
@@ -16,15 +17,41 @@ function replacement() {
}
replacement "${GIT_AUTHOR_NAME}"
-if [ "x$NAME" == "x" ] ; then
- echo -e "\nERROR: When changing ${GIT_COMMIT} we got empty reply."
- echo -e "I do not know how to map ${GIT_AUTHOR_NAME}.\n"
- set|grep ^GIT
- exit 1
+#if [ "x$NAME" == "x" ] ; then
+# echo -e "\nERROR: When changing ${GIT_COMMIT} we got empty reply."
+# echo -e "I do not know how to map ${GIT_AUTHOR_NAME}.\n"
+# set|grep ^GIT
+# exit 1
+#fi
+
+if [ "x$NAME" != "x" ] ; then
+export GIT_AUTHOR_NAME="$NAME"
+export GIT_AUTHOR_EMAIL="$MAIL"
+export GIT_COMMITTER_NAME="$NAME"
+export GIT_COMMITTER_EMAIL="$MAIL"
fi
+' -- --tags
+
+git filter-branch -f --env-filter '
+function replacement() {
+ REPL=$(awk -F"[[:space:]]*=[[:space:]]*" "/$1/ {print \$2}" $AUTHORS_FILE)
+ MAIL=$(echo "$REPL"|awk "{print \$NF}"|tr -d "<>" )
+ NAME=$(echo "$REPL"|awk "{print gensub(/[[:space:]]*<[^[:space:]]*/,\"\",\"\")}" )
+}
+
+replacement "${GIT_AUTHOR_NAME}"
+#if [ "x$NAME" == "x" ] ; then
+# echo -e "\nERROR: When changing ${GIT_COMMIT} we got empty reply."
+# echo -e "I do not know how to map ${GIT_AUTHOR_NAME}.\n"
+# set|grep ^GIT
+# exit 1
+#fi
+
+if [ "x$NAME" != "x" ] ; then
export GIT_AUTHOR_NAME="$NAME"
export GIT_AUTHOR_EMAIL="$MAIL"
export GIT_COMMITTER_NAME="$NAME"
export GIT_COMMITTER_EMAIL="$MAIL"
+fi
' -- --all