Experiment scaling via launch of mate-settings-daemon
[khome.git] / home / bin / git-edit-email
1 #!/bin/sh
2
3 # =============================================================================
4 # This is a modified version of this:
5 # https://help.github.com/articles/changing-author-info
6 # =============================================================================
7
8
9 FILTER_SCRIPT_TEMPLATE='
10 an="$GIT_AUTHOR_NAME";
11 am="$GIT_AUTHOR_EMAIL";
12 cn="$GIT_COMMITTER_NAME";
13 cm="$GIT_COMMITTER_EMAIL";
14
15 if [ "$GIT_COMMITTER_EMAIL" = "OLD_COMMITTER_EMAIL" ];
16 then
17 cn="$GIT_COMMITTER_NAME";
18 cm="NEW_COMMITTER_EMAIL";
19 fi;
20
21 if [ "$GIT_AUTHOR_EMAIL" = "OLD_AUTHOR_EMAIL" ];
22 then
23 an="$GIT_AUTHOR_NAME";
24 am="NEW_AUTHOR_EMAIL";
25 fi;
26
27 export GIT_AUTHOR_NAME="$an";
28 export GIT_AUTHOR_EMAIL="$am";
29 export GIT_COMMITTER_NAME="$cn";
30 export GIT_COMMITTER_EMAIL="$cm";
31 '
32
33
34 git_filter_branch() {
35 git filter-branch -f --env-filter "$1"
36 }
37
38
39 main() {
40 old_email="$1"
41 new_email="$2"
42
43 filter_script=$(\
44 echo $FILTER_SCRIPT_TEMPLATE \
45 | sed "s/OLD_COMMITTER_EMAIL/$old_email/g" \
46 | sed "s/NEW_COMMITTER_EMAIL/$new_email/g" \
47 | sed "s/OLD_AUTHOR_EMAIL/$old_email/g" \
48 | sed "s/NEW_AUTHOR_EMAIL/$new_email/g" \
49 )
50
51 git_filter_branch "$filter_script"
52 }
53
54 main "$@"
This page took 0.085174 seconds and 4 git commands to generate.