Debian Codegraph @

tools/windows/create-test-repo.bat

raw
1
2 :: Use pushd, so we can popd back at the end (directory changes are not contained inside batch file)
3 PUSHD C:\Windows\Temp
4
5 @echo off
6
7 :: Determine unique git repo name
8 :: We use Python to determine to get a datetime stamp since other workarounds in BATCH are locale dependent
9 :: Note that we double escape the % in the format string to %%
10 FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import datetime; print(datetime.datetime.now().strftime('%%Y-%%m-%%d_%%H-%%M-%%S'))"`) DO (
11 SET datetime=%%F
12 )
13 echo %datetime%
14 set Reponame=gitlint-test-%datetime%
15 echo %Reponame%
16
17 :: Create git repo
18 git init --initial-branch main %Reponame%
19 cd %Reponame%
20
21 :: Do some basic config
22 git config user.name gïtlint-test-user
23 git config user.email [email protected]
24 git config core.quotePath false
25 git config core.precomposeUnicode true
26
27 :: Add a test commit
28 echo "tëst 123" > test.txt
29 git add test.txt
30 git commit -m "test cömmit title" -m "test cömmit body that has a bit more text"
31
32 :: echo. -> the dot allows us to print an empty line
33 echo.
34 echo Created C:\Windows\Temp\%Reponame%
35
36 :: Move back to original dir
37 POPD