File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -411,12 +411,9 @@ __git_refs_remotes ()
411
411
412
412
__git_remotes ()
413
413
{
414
- local i IFS= $' \n ' d=" $( __gitdir) "
414
+ local d=" $( __gitdir) "
415
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
420
417
}
421
418
422
419
__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
351
351
__gitcomp_nl "$invalid_variable_name"
352
352
'
353
353
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
+
354
373
test_expect_success ' basic' '
355
374
run_completion "git " &&
356
375
# built-in
You can’t perform that action at this time.
0 commit comments