summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-16 21:16:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-16 21:16:49 (GMT)
commit98349e5364da6164add4ede3e63ceba2cc39159b (patch)
tree06e063d0b2cd69e9f6e783dd29a354e62ae1e8c8 /contrib
parentc11dc64722fc0bb496efb1b6de87012a132c04fc (diff)
parentfca416a41e90be0102b48949522ff0d2dc258c53 (diff)
downloadgit-98349e5364da6164add4ede3e63ceba2cc39159b.zip
git-98349e5364da6164add4ede3e63ceba2cc39159b.tar.gz
git-98349e5364da6164add4ede3e63ceba2cc39159b.tar.bz2
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.bash18
1 files changed, 7 insertions, 11 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2ed230a..d548e99 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 ()