git-dude icon indicating copy to clipboard operation
git-dude copied to clipboard

Breaks with parenthesis in the repo name

Open Grokzen opened this issue 9 years ago • 2 comments

If i have a repo with a parenthesis in the name the script breaks when running eval

icon_path=/home/grok/code/salt-states/icon.png
cd "$dir_name"; git rev-parse --git-dir 2>/dev/null
cd "$dir_name"; git config dude.ignore
basename "$dir_name" .git
git config dude.remote || true
git fetch $remote 2>&1 | grep -F -- '->' | sed 's/^ [+*=!-] //'
git config dude.icon || true
pwd
icon_path=/home/grok/code/salt-states\ (copy)/icon.png
/home/grok/bin/git-dude: eval: line 67: syntax error near unexpected token `('

Grokzen avatar Apr 23 '15 10:04 Grokzen

The dude.remote support was added in my fork. Created a pull request #43 just now to upstream into this repository. It's likely that this issue is not related to dude.remote, but anyhow I wanted to let you know to avoid any confusion.

holmboe avatar Aug 15 '16 11:08 holmboe

    icon_path=$(git config dude.icon || true)
    icon_path=${icon_path:-`pwd`/icon.png}
    icon_path=${icon_path// /\\ } # escape spaces before eval
    eval icon_path=$icon_path # to expand ~

Fails when you have a directory with ( or ) Fixed by this:

    icon_path=$(git config dude.icon || true)
    icon_path=${icon_path:-`pwd`/icon.png}
    icon_path=${icon_path// /\\ } # escape spaces before eval
    icon_path=${icon_path//(/\\ } # escape brackets before eval
    icon_path=${icon_path//)/\\ } # escape brackens before eval
    eval icon_path=$icon_path # to expand ~

vervaekejonathan avatar Apr 27 '17 11:04 vervaekejonathan