Skip to content

Support newline in git config values #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions git-sh.bash
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,16 @@ done
# Create aliases for everything defined in the gitconfig [alias] section.
_git_import_aliases () {
eval "$(
git config --get-regexp 'alias\..*' |
sed 's/^alias\.//' |
while read key command
git config --list --name-only |
sed -n 's/^alias\.//p' |
while read key
do
command=$(git config --get "alias.$key")
if expr -- "$command" : '!' >/dev/null
then echo "alias $key='git $key'"
else echo "gitalias $key=\"git $command\""
else echo "gitalias $key=\"git $(set -f; printf '%s ' $command)\""
# Newlines in aliases that are not shell commands will be
# considered whitespace (as git itself would do).
fi
done
)"
Expand Down