File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff line change @@ -351,6 +351,25 @@ test_expect_success '__gitcomp_nl - doesnt fail because of invalid variable name
351351 __gitcomp_nl "$invalid_variable_name"
352352'
353353
354+ test_expect_success ' __git_remotes - list remotes from $GIT_DIR/remotes and from config file' '
355+ cat >expect <<-EOF &&
356+ remote_from_file_1
357+ remote_from_file_2
358+ remote_in_config_1
359+ remote_in_config_2
360+ EOF
361+ test_when_finished "rm -rf .git/remotes" &&
362+ mkdir -p .git/remotes &&
363+ >.git/remotes/remote_from_file_1 &&
364+ >.git/remotes/remote_from_file_2 &&
365+ test_when_finished "git remote remove remote_in_config_1" &&
366+ git remote add remote_in_config_1 git://remote_1 &&
367+ test_when_finished "git remote remove remote_in_config_2" &&
368+ git remote add remote_in_config_2 git://remote_2 &&
369+ __git_remotes >actual &&
370+ test_cmp expect actual
371+ '
372+
354373test_expect_success ' basic' '
355374 run_completion "git " &&
356375 # built-in
You can’t perform that action at this time.
0 commit comments