Skip to content

Commit ee04fbd

Browse files
committed
refactor the script for git fetch
1 parent 28e7815 commit ee04fbd

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

RecursiveGitFetch.bat

+16-11
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22
echo Mission Started: %date% %time%
33
setlocal EnableDelayedExpansion
44
set repositoryCount=0
5-
Call :GitFetch %cd%
5+
Call :RecursiveFolders %cd%
66
echo Mission Completed: %date% %time%
77
Exit /B 0
88

9-
:GitFetch
9+
:RecursiveFolders
1010
IF EXIST .git (
11-
set /a repositoryCount+=1
12-
echo !repositoryCount! %cd%
13-
git remote -v
14-
echo Fetch Started: %date% %time%
15-
git fetch --all
16-
echo Fetch Completed: %date% %time%
17-
echo.
11+
Call :GitFetch
1812
)
19-
Call :CountSubFolders "%*",value2
13+
Call :CountSubFolders "%~1",value2
2014
if not !value2! == 0 (
2115
for /d %%i in ("%~1"\*) do (
2216
cd "%%~i"
23-
Call :GitFetch "%%~i"
17+
Call :RecursiveFolders "%%~i"
2418
cd ..
2519
)
2620
)
2721
exit /b %ERRORLEVEL%
2822

23+
:GitFetch
24+
set /a repositoryCount+=1
25+
echo !repositoryCount! %cd%
26+
git remote -v
27+
echo Fetch Started: %date% %time%
28+
git fetch --all
29+
echo Fetch Completed: %date% %time%
30+
echo.
31+
exit /b %ERRORLEVEL%
32+
33+
2934
:CountSubFolders
3035
set "count=0"
3136
cd "%~1"

0 commit comments

Comments
 (0)