Skip to content

Commit

Permalink
Support newlines in git aliases that are not shell commands
Browse files Browse the repository at this point in the history
The newlines are changed to spaces in the alias to avoid the execution
of several shell commands just as git (2.11) does.
  • Loading branch information
g-raud committed Oct 31, 2017
1 parent 28392e2 commit 6f15a73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion git-sh.bash
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ _git_import_aliases () {
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

0 comments on commit 6f15a73

Please sign in to comment.