SRombauts / UEGitPlugin

Unreal Engine 5 Git LFS 2 Source Control Plugin (beta)
http://srombauts.github.io/UEGitPlugin
MIT License
806 stars 165 forks source link

Engine versioning support with this plugin #180

Closed GMatrixGames closed 1 year ago

GMatrixGames commented 1 year ago

Hi.

From what I've seen, this plugin handles src control stuff very similarly Perforce. The one thing I've been looking for is a way to update the versioning information for my engine build, similar to Perforce, but through Git instead. (Example, Engine\Build\Build.version information updates like Branch and Changelist tied to git branch and commit number for branch, etc.)

Is there a way to add this functionality into this plugin, or are there any suggestions on how to get this functionality by doing it myself.

Thanks!

GMatrixGames commented 1 year ago
#!/bin/sh

branch=$(git rev-parse --abbrev-ref HEAD)

revcount=$(git rev-list --count $branch)

echo $revcount

modifiedrev=$(($revcount + 1))

echo $modifiedrev

basename=$(basename -s .git `git config --get remote.origin.url`)
branch=("++$basename+$branch")

contents="$(jq --arg branch "$branch" --arg modifiedrev "$modifiedrev" '. + {BranchName:$branch, Changelist:$modifiedrev|tonumber}' Engine/Build/Build.version)" && \
echo -E "${contents}" > Engine/Build/Build.version

git add Engine/Build/Build.version

echo "Updated Build.version to be inline with Git"

I made a pre-commit git hook to do this.