Skip to content

Commit

Permalink
also ignore subdirs of _Z_EXCLUDE_DIRS
Browse files Browse the repository at this point in the history
  • Loading branch information
rupa committed Feb 14, 2015
1 parent b620b0a commit c507bdd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ NOTES
Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your-
self.
Set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude.
Set $_Z_OWNER to allow usage when in 'sudo -s' mode.
(These settings should go in .bashrc/.zshrc before the line
added above.)
Expand Down Expand Up @@ -121,8 +121,8 @@ ENVIRONMENT
to handle PROMPT_COMMAND or precmd yourself.

The environment variable $_Z_EXCLUDE_DIRS can be set to an array of
directories to exclude from tracking. $HOME is always excluded. Direc-
tories must be full paths without trailing slashes.
directory trees to exclude from tracking. $HOME is always excluded.
Directories must be full paths without trailing slashes.

The environment variable $_Z_OWNER can be set to your username, to
allow usage of z when your sudo enviroment keeps $HOME set.
Expand Down
4 changes: 2 additions & 2 deletions z.1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution.
Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself.
.RE
.RS
Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directories to exclude.
Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directory trees to exclude.
.RE
.RS
Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode.
Expand Down Expand Up @@ -147,7 +147,7 @@ The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to
handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself.
.P
The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of
directories to exclude from tracking. \fB$HOME\fR is always excluded.
directory trees to exclude from tracking. \fB$HOME\fR is always excluded.
Directories must be full paths without trailing slashes.
.P
The environment variable \fB$_Z_OWNER\fR can be set to your username, to
Expand Down
4 changes: 2 additions & 2 deletions z.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ _z() {
# $HOME isn't worth matching
[ "$*" = "$HOME" ] && return

# don't track excluded dirs
# don't track excluded directory trees
local exclude
for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
[ "$*" = "$exclude" ] && return
case "$*" in $exclude*) return;; esac
done

# maintain the data file
Expand Down

0 comments on commit c507bdd

Please sign in to comment.