# HG changeset patch # User Peter Arrenbrecht # Date 1589177620 -7200 # Node ID f71c8eea7161c6292389339557d9e538e0fcdc51 # Parent a6e12d477595b96d6a95f1e32f2dd4762d136b17 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 diff -r a6e12d477595 -r f71c8eea7161 contrib/bash_completion --- a/contrib/bash_completion Tue May 12 01:03:12 2020 +0200 +++ b/contrib/bash_completion Mon May 11 08:13:40 2020 +0200 @@ -160,7 +160,10 @@ if [[ -n "$aliashg" ]]; then aliashg=${aliashg#"alias $hg='"} aliashg=${aliashg%"'"} - hg=$aliashg + # `source`d aliases break completion, so ignore them + if [[ "${aliashg:0:7}" != "source " ]]; then + hg=$aliashg + fi fi COMPREPLY=()