backport of repo-completion for bash version 3.x, tested on 3.2.25

Using arrays instead of associative arrays, which were introduced
in bash version 4.

Change-Id: I28a12bc24aafc9c8df400e046604e75e5a2b1962