File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,18 @@ if errorlevel 1 (
5555 goto done
5656)
5757
58+ rem // Get commit count from HEAD by default
5859for /F %%I IN ('call %GIT% rev-list HEAD --count') do set GIT_VERSION = %%I
59- for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION = %GIT_VERSION% -%%I
60+
61+ rem // If we're in AppVeyor and we're building for master: Get commit count from unshallowed upstream
62+ if defined APPVEYOR (
63+ if not defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (
64+ call %GIT% remote add upstream https://github.com/RPCS3/RPCS3.git
65+ call %GIT% fetch --unshallow upstream
66+ for /F %%I IN ('call %GIT% rev-list --count upstream/master') do set GIT_VERSION = %%I
67+ )
68+ )
69+
6070if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (
6171 if " %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% " == " master" (
6272 for /f " tokens=1* delims=/" %%a in (" %APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME% " ) do set user = %%a
@@ -69,6 +79,12 @@ if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (
6979 for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH = %%I
7080)
7181
82+ rem // Get last commit (shortened) and concat after commit count in GIT_VERSION
83+ for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION = %GIT_VERSION% -%%I
84+
85+ rem // Echo obtained GIT_VERSION for debug purposes if needed
86+ echo %GIT_VERSION%
87+
7288rem // Don't modify the file if it already has the current version.
7389if exist " %GIT_VERSION_FILE% " (
7490 findstr /C:" %GIT_VERSION% " " %GIT_VERSION_FILE% " > NUL
You can’t perform that action at this time.
0 commit comments