From 8f19f35b068681608b276b2fdfa46409e547f1b2 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Tue, 16 Oct 2012 10:58:07 +1300 Subject: [PATCH] Fixed completion appending '//' when in a project's directory --- lib/git/aliases.sh | 4 ++-- lib/git/repo_index.sh | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/git/aliases.sh b/lib/git/aliases.sh index bf20def..30ca365 100644 --- a/lib/git/aliases.sh +++ b/lib/git/aliases.sh @@ -143,7 +143,7 @@ if [ $shell = "bash" ]; then # Git repo management & aliases. # If you know how to rewrite _git_index_tab_completion() for zsh, please send me a pull request! - complete -o nospace -o filenames -F _git_index_tab_completion git_index - complete -o nospace -o filenames -F _git_index_tab_completion $git_index_alias + complete -o nospace -F _git_index_tab_completion git_index + complete -o nospace -F _git_index_tab_completion $git_index_alias fi diff --git a/lib/git/repo_index.sh b/lib/git/repo_index.sh index 5558dbb..82159a1 100644 --- a/lib/git/repo_index.sh +++ b/lib/git/repo_index.sh @@ -81,8 +81,9 @@ function git_index() { # If $1 starts with '/', change to top-level directory within $GIT_REPO_DIR elif ([ $shell = "bash" ] && [ "${1:0:1}" = "/" ]) || \ ([ $shell = "zsh" ] && [ "${1[1]}" = "/" ]); then - if [ -d "$GIT_REPO_DIR$1" ]; then "cd" "$GIT_REPO_DIR$1"; fi - + if [ -d "$GIT_REPO_DIR$1" ]; then + builtin cd "$GIT_REPO_DIR$1" + fi else _check_git_index # Figure out which directory we need to change to. @@ -107,7 +108,7 @@ function git_index() { if [[ "$base_path" == "~"* ]]; then base_path=$(eval echo ${base_path%%/*})/${base_path#*/} fi - "cd" "$base_path" + builtin cd "$base_path" # Run git callback (either update or show changes), if we are in the root directory if [ -z "${sub_path%/}" ]; then _git_index_status_if_dirty; fi else