forked from OpenSiFli/SiFli-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_commit_env.bat
More file actions
58 lines (51 loc) · 1.2 KB
/
init_commit_env.bat
File metadata and controls
58 lines (51 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
color 0a
:start
cls
echo,
echo Initial Commit Env
echo,
echo 1 Gitlab Repo Url
echo,
echo 2 Gerrit Repo Url
echo,
echo 3 Submodule Gerrit Repo Url
echo,
echo 0 Cancel
echo,
echo,
setlocal enabledelayedexpansion
set /p line=<.git
::echo line is %line%
if "%line%"=="" (
set "dst=.\.git"
) else (
if "%line%"=="%line:modules= %" (
set "line=%line:worktrees= %"
)
for /f "tokens=2 delims= " %%a in ("!line!") do (
set "dst=%%a"
)
set "dst=!dst:/=\!"
)
::echo %dst%
choice /c:1230 /n /m:"please enter an option:"
if %errorlevel%==0 exit
if %errorlevel%==1 goto gitlab
if %errorlevel%==2 goto gerrit
if %errorlevel%==3 goto submodule
exit
:gitlab
copy tools\autotest\commitEnvScripts\pre-commit %dst%\hooks\>nul /Y
git config commit.template .commit_template
exit
:gerrit
copy tools\autotest\commitEnvScripts\commit-msg %dst%\hooks\>nul /Y
copy tools\autotest\commitEnvScripts\pre-commit %dst%\hooks\>nul /Y
git config commit.template .commit_template
exit
:submodule
copy tools\autotest\commitEnvScripts\commit-msg %dst%\hooks\>nul /Y
copy tools\autotest\commitEnvScripts\pre-commit %dst%\hooks\>nul /Y
git config commit.template .commit_template
exit