Created
September 20, 2013 00:11
-
-
Save bhank/6631617 to your computer and use it in GitHub Desktop.
A batch file to launch TortoiseProc.exe or TortoiseGitProc.exe as appropriate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SET FOUND= | |
SET SEARCHPATH=%CD% | |
SET LASTSEARCHPATH= | |
ECHO %~nx0: finding source control dir for %SEARCHPATH% | |
:loop | |
CALL :checkdir "%SEARCHPATH%" | |
IF NOT "%FOUND%"=="" GOTO %FOUND% | |
SET LASTSEARCHPATH=%SEARCHPATH% | |
FOR %%i IN ("%SEARCHPATH%\..") DO SET SEARCHPATH=%%~fi | |
IF "%SEARCHPATH%"=="%LASTSEARCHPATH%" goto notfound | |
GOTO loop | |
echo The End | |
GOTO :EOF | |
:checkdir | |
ECHO Checking %~f1 | |
IF EXIST "%~f1\.git\." SET FOUND=git | |
IF EXIST "%~f1\.svn\." SET FOUND=svn | |
GOTO :EOF | |
:svn | |
echo It's svn! | |
echo Running: tortoiseproc.exe %* | |
start tortoiseproc.exe %* | |
goto :EOF | |
:git | |
echo It's git! | |
echo Running: tortoisegitproc.exe %* | |
start tortoisegitproc.exe %* | |
goto :EOF | |
:notfound | |
echo Not found! | |
exit /b 1 | |
goto :EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment