summaryrefslogtreecommitdiffstats
path: root/tools/windows/create-test-repo.bat
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-11-03 06:07:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-11-03 06:07:48 +0000
commit85812cd25d9e2f015bb71b26d51458b3718bf6c7 (patch)
tree463ad57ffbe3636e06e9bb36104fbf12938e78c1 /tools/windows/create-test-repo.bat
parentReleasing debian version 0.13.1-6. (diff)
downloadgitlint-85812cd25d9e2f015bb71b26d51458b3718bf6c7.tar.xz
gitlint-85812cd25d9e2f015bb71b26d51458b3718bf6c7.zip
Merging upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/windows/create-test-repo.bat')
-rw-r--r--tools/windows/create-test-repo.bat20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/windows/create-test-repo.bat b/tools/windows/create-test-repo.bat
index 4220ad1..27e3394 100644
--- a/tools/windows/create-test-repo.bat
+++ b/tools/windows/create-test-repo.bat
@@ -2,15 +2,16 @@
:: Use pushd, so we can popd back at the end (directory changes are not contained inside batch file)
PUSHD C:\Windows\Temp
-:: Determine unique git repo name
-:: Note that date/time parsing on windows is locale dependent, so this might not work on every windows machine
-:: (see https://stackoverflow.com/questions/203090/how-do-i-get-current-date-time-on-the-windows-command-line-in-a-suitable-format)
@echo off
-For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
-For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a-%%b)
-echo %mydate%_%mytime%
-set Reponame=gitlint-test-%mydate%_%mytime%
+:: Determine unique git repo name
+:: We use Python to determine to get a datetime stamp since other workarounds in BATCH are locale dependent
+:: Note that we double escape the % in the format string to %%
+FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import datetime; print(datetime.datetime.now().strftime('%%Y-%%m-%%d_%%H-%%M-%%S'))"`) DO (
+SET datetime=%%F
+)
+echo %datetime%
+set Reponame=gitlint-test-%datetime%
echo %Reponame%
:: Create git repo
@@ -28,8 +29,9 @@ echo "tëst 123" > test.txt
git add test.txt
git commit -m "test cömmit title" -m "test cömmit body that has a bit more text"
-:: echo. -> the dot allows us to print and empty line
+:: echo. -> the dot allows us to print an empty line
echo.
echo Created C:\Windows\Temp\%Reponame%
+
:: Move back to original dir
-POPD
+POPD \ No newline at end of file