diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-10-16 14:16:49 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-16 14:16:49 -0700 |
commit | 98349e5364da6164add4ede3e63ceba2cc39159b (patch) | |
tree | 06e063d0b2cd69e9f6e783dd29a354e62ae1e8c8 /contrib | |
parent | Merge branch 'bw/trace-no-inline-getnanotime' (diff) | |
parent | completion: use "git -C $there" instead of (cd $there && git ...) (diff) | |
download | tgif-98349e5364da6164add4ede3e63ceba2cc39159b.tar.xz |
Merge branch 'jc/completion-no-chdir'
* jc/completion-no-chdir:
completion: use "git -C $there" instead of (cd $there && git ...)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/completion/git-completion.bash | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2ed230a861..d548e99ebc 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -281,16 +281,12 @@ __gitcomp_file () # argument, and using the options specified in the second argument. __git_ls_files_helper () { - ( - test -n "${CDPATH+set}" && unset CDPATH - cd "$1" - if [ "$2" == "--committable" ]; then - git diff-index --name-only --relative HEAD - else - # NOTE: $2 is not quoted in order to support multiple options - git ls-files --exclude-standard $2 - fi - ) 2>/dev/null + if [ "$2" == "--committable" ]; then + git -C "$1" diff-index --name-only --relative HEAD + else + # NOTE: $2 is not quoted in order to support multiple options + git -C "$1" ls-files --exclude-standard $2 + fi 2>/dev/null } @@ -522,7 +518,7 @@ __git_complete_index_file () ;; esac - __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_" + __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_" } __git_complete_file () |