-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from liquidata-inc/aaron/checkcommitters-local…
…-mode go/utils: Improve checkcommitters; add prepr.sh.
- Loading branch information
Showing
6 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
force= | ||
if [[ $# -gt 0 ]]; then | ||
if [ "$1" = "-f" ]; then | ||
force=`shift` | ||
fi | ||
fi | ||
|
||
if [[ $# -ne 4 && $# -ne 2 ]]; then | ||
echo "Usage: fix_committer.sh [-f] TARGET_BRANCH WRONG_EMAIL [RIGHT_NAME RIGHT_EMAIL]" 1>&2 | ||
echo " Example: fix_committer.sh master [email protected] \"Aaron Son\" \"[email protected]\"" 1>&2 | ||
echo " If RIGHT_NAME and RIGHT_EMAIL are ommitted, they are taken to be the current user from git config" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
script_dir=$(dirname "$0") | ||
cd $script_dir/../../.. | ||
|
||
target=$1 | ||
wrongemail=$2 | ||
if [[ $# -eq 4 ]]; then | ||
rightname=$3 | ||
rightemail=$4 | ||
else | ||
rightname=$(git config --get user.name) | ||
rightemail=$(git config --get user.email) | ||
fi | ||
|
||
mergebase=`git merge-base HEAD "remotes/origin/$target"` | ||
|
||
exec git "$force" filter-branch --env-filter ' | ||
OLD_EMAIL="'"$wrongemail"'" | ||
CORRECT_NAME="'"$rightname"'" | ||
CORRECT_EMAIL="'"$rightemail"'" | ||
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 | ||
' ${mergebase}..HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
script_dir=$(dirname "$0") | ||
cd $script_dir/../.. | ||
|
||
target="master" | ||
if [[ $# -eq 1 ]]; then | ||
target="$1" | ||
fi | ||
|
||
# Keep this in sync with Jenkinsfile contents that | ||
# are easy to evaluate locally and might commonly fail. | ||
|
||
go get -mod=readonly ./... | ||
./utils/repofmt/check_fmt.sh | ||
./Godeps/verify.sh | ||
go run ./utils/checkcommitters -dir "$target" | ||
go vet -mod=readonly ./... | ||
go run -mod=readonly ./utils/copyrightshdrs/ |