-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclone-tracking.bat
51 lines (44 loc) · 1.46 KB
/
clone-tracking.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
@echo off
SET "CLONEBAT=clone.bat"
FOR /F "tokens=*" %%i IN ('git ls-files -v %CLONEBAT%') DO SET "CURRENT_STATUS=%%i"
IF "%CURRENT_STATUS:~0,1%"=="S" (
ECHO Currently, the file %CLONEBAT% is skipped.
ECHO Turning file tracking back ON...
git update-index --no-skip-worktree "%CLONEBAT%"
IF ERRORLEVEL 0 (
ECHO File tracking turned on successfully.
) ELSE (
ECHO Error: Could not turn file tracking on.
)
) ELSE (
ECHO Currently, the file %CLONEBAT% is being tracked.
ECHO Turning file tracking OFF...
git update-index --skip-worktree "%CLONEBAT%"
IF ERRORLEVEL 0 (
ECHO File tracking turned off successfully.
) ELSE (
ECHO Error: Could not turn file tracking off.
)
)
SET "CLONESH=clone.sh"
FOR /F "tokens=*" %%i IN ('git ls-files -v %CLONESH%') DO SET "CURRENT_STATUS=%%i"
IF "%CURRENT_STATUS:~0,1%"=="S" (
ECHO Currently, the file %CLONESH% is skipped.
ECHO Turning file tracking back ON...
git update-index --no-skip-worktree "%CLONESH%"
IF ERRORLEVEL 0 (
ECHO File tracking turned on successfully.
) ELSE (
ECHO Error: Could not turn file tracking on.
)
) ELSE (
ECHO Currently, the file %CLONESH% is being tracked.
ECHO Turning file tracking OFF...
git update-index --skip-worktree "%CLONESH%"
IF ERRORLEVEL 0 (
ECHO File tracking turned off successfully.
) ELSE (
ECHO Error: Could not turn file tracking off.
)
)
EXIT /B 0