You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
gitk.cmd fails when user profile folder name has ampersand symbol #245
The gitk.cmd script will fail in this case because & is recognized as joining two commands in a batch script, unless if the path is double quoted.
The easiest fix for this is to use "delayed expansion" coupled with ! (instead of %) to demarcate the environment variable names.
Fixed script:
@rem Do not use "echo off" to not affect any child calls.
@setlocal enableDelayedExpansion
@rem Get the absolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=!git_install_root!\bin;!git_install_root!\mingw\bin;!PATH!
@if not exist "!HOME!" @set HOME=!HOMEDRIVE!!HOMEPATH!
@if not exist "!HOME!" @set HOME=!USERPROFILE!
@start "gitk" wish.exe "!git_install_root!\bin\gitk" -- %*
Original script:
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the absolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@start "gitk" wish.exe "%git_install_root%\bin\gitk" -- %*
This is not about laziness BTW, but also about things like maintaining correct authorship and giving proper credit.
Well, not to forget about the respect and gratitude to contribute back to a project that lives on contributions. Never forget that this project is built on a great community, and you have the opportunity to be part of that community. By contributing.
Activity
sschuberth commentedon Sep 14, 2014
Thanks. Would you mind making a pull request out of this?
ADTC commentedon Sep 14, 2014
I didn't feel like forking the project just for this one-off fix, but since you insist I will :) 👍
sschuberth commentedon Sep 14, 2014
Thanks. This is not about laziness BTW, but also about things like maintaining correct authorship and giving proper credit.
ADTC commentedon Sep 14, 2014
I understand. Unfortunately I cannot find
gitk.cmdin the repository. Am I looking at the wrong repo?sschuberth commentedon Sep 14, 2014
Probably. As that file is not strictly related to the pure port of Git to Windows, but a convenience tool, it's in msysgit/msysgit.
dscho commentedon Sep 14, 2014
Well, not to forget about the respect and gratitude to contribute back to a project that lives on contributions. Never forget that this project is built on a great community, and you have the opportunity to be part of that community. By contributing.