Fixed case where more than one project matched the completed word

This commit is contained in:
Nathan Broadbent
2011-12-20 11:29:44 +08:00
parent 80bd4decac
commit 9e701a18e5

View File

@@ -85,7 +85,7 @@ function git_index() {
# Figure out which directory we need to change to. # Figure out which directory we need to change to.
local project=$(echo $1 | cut -d "/" -f1) local project=$(echo $1 | cut -d "/" -f1)
# Find base path of project # Find base path of project
local base_path="$(grep "/$project$" "$GIT_REPO_DIR/.git_index")" local base_path="$(grep -m1 "/$project$" "$GIT_REPO_DIR/.git_index")"
if [ -n "$base_path" ]; then if [ -n "$base_path" ]; then
sub_path=$(echo $1 | sed "s:^$project::") sub_path=$(echo $1 | sed "s:^$project::")
# Append subdirectories to base path # Append subdirectories to base path