Mercurial > hg-stable
changeset 44776:f71c8eea7161 stable
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
author | Peter Arrenbrecht <peter@arrenbrecht.ch> |
---|---|
date | Mon, 11 May 2020 08:13:40 +0200 |
parents | a6e12d477595 |
children | edffab2cf0ea |
files | contrib/bash_completion |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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=()