-
Notifications
You must be signed in to change notification settings - Fork 2
/
GIT_FETCH.bat
52 lines (37 loc) · 1000 Bytes
/
GIT_FETCH.bat
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
rem 'git_dir' EVAR may be set to specify location of '.git' folder for current console session
set remote_repo="https://github.com/Vicshann/GInjer.git"
ECHO remote_repo
set git_local=%~dp0.git
if not defined GITCMMNDIR goto NoBuild
for /f "delims=" %%F in ('dir "%~dp0*.sln" /b /o-n') do set sln_name=%%F
if not defined sln_name goto NoSlnFile
ECHO sln_name
SET sln_fldr=%sln_name:~0,-4%
ECHO sln_fldr
set git_lfldr=%GITCMMNDIR%\%sln_fldr%
ECHO git_lfldr
rmdir "%git_local%"
if exist "%git_local%" goto GitExist
rmdir "%git_lfldr%"
if exist "%git_lfldr%" (
ECHO "GIT objects is still present in the directory - restoring link"
mklink /J "%git_local%" "%git_lfldr%"
goto Exit
)
mkdir "%git_lfldr%"
mklink /J "%git_local%" "%git_lfldr%"
git init
git fetch %remote_repo%
git pull %remote_repo%
ECHO "Success!"
goto Exit
:NoSlnFile
ECHO "No solution file!"
goto Exit
:GitExist
ECHO "GIT folder already exist and not empty!"
goto Exit
:NoBuild
ECHO "No git object folder EVAR!"
:Exit
pause