Skip to content

Commit 53e53c7

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2acc194 commit 53e53c7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,9 @@ __git_refs_remotes ()
411411

412412
__git_remotes ()
413413
{
414-
local i IFS=$'\n' d="$(__gitdir)"
414+
local d="$(__gitdir)"
415415
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
420417
}
421418

422419
__git_list_merge_strategies ()

0 commit comments

Comments
 (0)