Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 28392e2

Browse files
committed
Support newlines in git aliases that are shell commands
Parse an aliases' newline-delimited list that does not contain the values, then retrieve each value one by one.
1 parent 467c388 commit 28392e2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

git-sh.bash

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ done
163163
# Create aliases for everything defined in the gitconfig [alias] section.
164164
_git_import_aliases () {
165165
eval "$(
166-
git config --get-regexp 'alias\..*' |
167-
sed 's/^alias\.//' |
168-
while read key command
166+
git config --list --name-only |
167+
sed -n 's/^alias\.//p' |
168+
while read key
169169
do
170+
command=$(git config --get "alias.$key")
170171
if expr -- "$command" : '!' >/dev/null
171172
then echo "alias $key='git $key'"
172173
else echo "gitalias $key=\"git $command\""

0 commit comments

Comments
 (0)