Browse files

Fix for numbered directories or files

This commit fixes some odd behavior for numbered files and
directories. Even if the environment variables is undefined
cd'ing into a numbered directory is not possible. This pathc
fixes this by checking if the argument is a valid
file or directory and is numnbered and if this is the case will
only output the argument values instead of a substitution with $e..

In case there exist both, numbered valid argument and the
directory or folder, the file will always win to avoid clashes with
standard wrapped functions like cd, rm, mv...
  • Loading branch information...
1 parent 6d297ae commit fcf5dd3f6fcd30dde451aef855f7e37fd99216b0 @grundprinzip grundprinzip committed Jan 8, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/git/
@@ -121,7 +121,11 @@ scmb_expand_args() {
for arg in "$@"; do
if [[ "$arg" =~ ^[0-9]+$ ]] ; then # Substitute $e{*} variables for any integers
if [ "$first" -eq 1 ]; then first=0; else printf '\t'; fi
- eval printf '%s' "\"\$$git_env_char$arg\""
+ if [ -e "$arg" ]; then
+ printf '%s' "$arg"
+ else
+ eval printf '%s' "\"\$$git_env_char$arg\""
+ fi
elif [[ "$arg" =~ ^[0-9]+-[0-9]+$ ]]; then # Expand ranges into $e{*} variables
for i in $(eval echo {${arg/-/..}}); do

0 comments on commit fcf5dd3

Please sign in to comment.