# HG changeset patch # User Sean Farley # Date 2013-11-20 18:19:55 # Node ID 191ab08e70993229fb6fe12f3dba2148fbc9ebae # Parent dd3af304b3c8684ee8327515d9e990d16c060d19 bash_completion: determine root executable in case of alias This solves an issue for users that have "alias hg='hg --some_opts'" where they would see wrong entries in the completion output (such as color codes). diff --git a/contrib/bash_completion b/contrib/bash_completion --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -130,12 +130,19 @@ shopt -s extglob _hg() { - local cur prev cmd cmd_index opts i + local cur prev cmd cmd_index opts i aliashg # global options that receive an argument local global_args='--cwd|-R|--repository' local hg="$1" local canonical=0 + aliashg=$(alias $hg 2>/dev/null) + if [[ -n "$aliashg" ]]; then + aliashg=${aliashg#"alias $hg='"} + aliashg=${aliashg%"'"} + hg=$aliashg + fi + COMPREPLY=() cur="$2" prev="$3"