Tweak git bat template

This fixes some issues with escaping, namely carets. For example,
without this patch, when HEAD^^1 is passed to batch script, it will
forward HEAD1 to git. With this patch, it will be forwarded as HEAD^^1
to git. There is still issue with HEAD^1 which seems not possible to fix
with batch script as batch receives HEAD1.

R=ehmaldonado@chromium.org

Change-Id: Ibb48ef06b4f17df374ee983eaa19ca43a706fa22
Bug: 1065307
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2130635
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
changes/35/2130635/4
Josip Sokcevic 5 years ago committed by LUCI CQ
parent 845b830530
commit 4741a12797

@ -2,4 +2,19 @@
setlocal
if not defined EDITOR set EDITOR=notepad
set PATH=%~dp0${GIT_BIN_RELDIR}\cmd;%~dp0;%PATH%
"%~dp0${GIT_BIN_RELDIR}\${GIT_PROGRAM}" %*
REM This hack tries to restore as many original arguments as possible
REM "HEAD^^1" is parsed correctly, but "HEAD^1" is still not.
REM TODO(crbug.com/1066663): Fix passing "HEAD^1" as argument.
call :RunGit "%*"
REM exit /b from call :RunGit won't be sent to the prompt.
if %ERRORLEVEL% NEQ 0 (
exit /b %ERRORLEVEL%
)
goto :eof
:RunGit
call "%~dp0${GIT_BIN_RELDIR}\${GIT_PROGRAM}" %~1
if %ERRORLEVEL% NEQ 0 (
exit /b %ERRORLEVEL%
)

Loading…
Cancel
Save