The reason is that the scripts tries to use the alias again when invoking `hg` internally: https://www.mercurial-scm.org/repo/hg/file/f365dfede78f/contrib/bash_completion#l159 I propose to add an env variable to disable this behaviour. For example: if [[ -z "$HGCOMPLETE_NOALIAS" ]]; then ... fi Alternative: Also filter the `source` statement for internal invocations. But this seems a bit too specific to my case. Basically: aliashg=${aliashg#"alias $hg='"} # existing aliashg=${aliashg#"source "} # new Would love to hear what the team prefers.
Fixed by https://mercurial-scm.org/repo/hg/rev/f71c8eea7161 Peter Arrenbrecht <peter@arrenbrecht.ch> bash_completion: do not use aliased hg if it sources a script (issue6308) I have an alias that sources a script around hg. Mercurial's bash_completion script tries to use this as its main hg binary. But sourcing a wrapper breaks Bash's completion. So this patch disables using the alias as the hg binary if it starts with "source ". Alias resolution was introduced in rev 191ab08e7099 for users with "alias hg='hg --some_opts'". See https://www.mercurial-scm.org/repo/hg/rev/191ab08e7099 (please test the fix)
Bug was set to TESTING for 7 days, resolving