completion: simplify __git_remotes()

The __git_remotes() helper function lists the remotes from the config file by processing the output of a 'git config' query. A simple 'git remote' produces the exact same output, so run that instead. Remotes under '$GIT_DIR/remotes' are still listed by running 'ls -1', because 'git remote' unfortunately ignores them. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Mar 4, 2015 at 15:10 UTC 53e53c7c81ce2c7c4cd45f95bc095b274cb28b76
1 file changed +2 -5
contrib/completion/git-completion.bash
+2 -5
@@ -411,12 +411,9 @@ __git_refs_remotes ()
411
412 __git_remotes ()
413 {
414 - local i IFS=$'\n' d="$(__gitdir)"
414 + local d="$(__gitdir)"
415 test -d "$d/remotes" && ls -1 "$d/remotes"
416 - for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
417 - i="${i#remote.}"
418 - echo "${i/.url*/}"
419 - done
416 + git --git-dir="$d" remote
417 }
418
419 __git_list_merge_strategies ()