Skip to content

Commit

Permalink
Merge branch 'jc/completion-no-chdir'
Browse files Browse the repository at this point in the history
* jc/completion-no-chdir:
  completion: use "git -C $there" instead of (cd $there && git ...)
  • Loading branch information
Junio C Hamano committed Oct 16, 2014
2 parents c11dc64 + fca416a commit 98349e5
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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 ()
Expand Down

0 comments on commit 98349e5

Please sign in to comment.