forked from Vicshann/Common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_GIT_FETCH_.bat
53 lines (38 loc) · 1.02 KB
/
_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
53
rem 'git_dir' EVAR may be set to specify location of '.git' folder for current console session
set remote_repo="https://github.com/Vicshann/Common.git"
ECHO remote_repo
set git_local=%~dp0.git
if not defined GITCMMNDIR goto NoBuild
rem for /f "delims=" %%F in ('dir "%~dp0*.sln" /b /o-n') do set sln_name=%%F
rem if not defined sln_name goto NoSlnFile
rem ECHO sln_name
rem SET sln_fldr=%sln_name:~0,-4%
rem ECHO sln_fldr
SET sln_fldr=common
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