Add git_fix_author script.
This commit is contained in:
@@ -18,6 +18,7 @@ let
|
|||||||
git_find_merged_branches = (
|
git_find_merged_branches = (
|
||||||
patchScriptBin "git_find_merged_branches" (builtins.readFile ./files/git_find_merged_branches.bash)
|
patchScriptBin "git_find_merged_branches" (builtins.readFile ./files/git_find_merged_branches.bash)
|
||||||
);
|
);
|
||||||
|
git_fix_author = (patchScriptBin "git_fix_author" (builtins.readFile ./files/git_fix_author.bash));
|
||||||
alias_rga = pkgs.writeShellScriptBin "rga" ''
|
alias_rga = pkgs.writeShellScriptBin "rga" ''
|
||||||
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
|
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
|
||||||
'';
|
'';
|
||||||
@@ -66,6 +67,8 @@ in
|
|||||||
decode_jwt
|
decode_jwt
|
||||||
jq
|
jq
|
||||||
inetutils # For whois
|
inetutils # For whois
|
||||||
|
git_find_merged_branches
|
||||||
|
git_fix_author
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
22
nix/configuration/roles/base/files/git_fix_author.bash
Normal file
22
nix/configuration/roles/base/files/git_fix_author.bash
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
git filter-branch --env-filter '
|
||||||
|
WRONG_EMAIL="old@email.foo"
|
||||||
|
NEW_NAME="New Name"
|
||||||
|
NEW_EMAIL="new@email.bar"
|
||||||
|
|
||||||
|
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
|
||||||
|
then
|
||||||
|
export GIT_COMMITTER_NAME="$NEW_NAME"
|
||||||
|
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
|
||||||
|
fi
|
||||||
|
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
|
||||||
|
then
|
||||||
|
export GIT_AUTHOR_NAME="$NEW_NAME"
|
||||||
|
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
|
||||||
|
fi
|
||||||
|
' --tag-name-filter cat --commit-filter 'git commit-tree -S "$@";' -- --branches --tags
|
||||||
Reference in New Issue
Block a user