Merge branch 'jc/completion-no-chdir'

* jc/completion-no-chdir:
  completion: use "git -C $there" instead of (cd $there && git ...)
This commit is contained in:
Junio C Hamano 2014-10-16 14:16:49 -07:00
commit 98349e5364

View File

@ -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 ()