Skip to content

Commit 676d4ba

Browse files
authored
Merge pull request #214 from adamrehn/clone-commits
Add the ability to clone a specific commit of the Unreal Engine
2 parents 7f575f9 + 9ba09bc commit 676d4ba

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

ue4docker/dockerfiles/ue4-source/linux/Dockerfile

+24-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COPY ${SOURCE_LOCATION} /home/ue4/UnrealEngine
2222
# The git repository that we will clone
2323
ARG GIT_REPO=""
2424

25-
# The git branch/tag that we will checkout
25+
# The git branch/tag/commit that we will checkout
2626
ARG GIT_BRANCH=""
2727

2828
{% if credential_mode == "secrets" %}
@@ -38,7 +38,18 @@ RUN chmod +x /tmp/git-credential-helper-secrets.sh
3838
ARG CHANGELIST
3939
RUN --mount=type=secret,id=username,uid=1000,required \
4040
--mount=type=secret,id=password,uid=1000,required \
41-
CHANGELIST="$CHANGELIST" git clone --progress --depth=1 -b $GIT_BRANCH $GIT_REPO {{ clone_opts }} /home/ue4/UnrealEngine
41+
CHANGELIST="$CHANGELIST" \
42+
mkdir /home/ue4/UnrealEngine && \
43+
cd /home/ue4/UnrealEngine && \
44+
git init && \
45+
{% if git_config %}
46+
{% for key, value in git_config.items() %}
47+
git config {{ key }} {{ value }} && \
48+
{% endfor %}
49+
{% endif %}
50+
git remote add origin "$GIT_REPO" && \
51+
git fetch --progress --depth 1 origin "$GIT_BRANCH" && \
52+
git checkout FETCH_HEAD
4253

4354
{% else %}
4455

@@ -56,7 +67,17 @@ ENV GIT_ASKPASS=/tmp/git-credential-helper-endpoint.sh
5667
RUN chmod +x /tmp/git-credential-helper-endpoint.sh
5768

5869
# Clone the UE4 git repository using the endpoint-supplied credentials
59-
RUN git clone --progress --depth=1 -b $GIT_BRANCH $GIT_REPO {{ clone_opts }} /home/ue4/UnrealEngine
70+
RUN mkdir /home/ue4/UnrealEngine && \
71+
cd /home/ue4/UnrealEngine && \
72+
git init && \
73+
{% if git_config %}
74+
{% for key, value in git_config.items() %}
75+
git config {{ key }} {{ value }} && \
76+
{% endfor %}
77+
{% endif %}
78+
git remote add origin "$GIT_REPO" && \
79+
git fetch --progress --depth 1 origin "$GIT_BRANCH" && \
80+
git checkout FETCH_HEAD
6081

6182
{% endif %}
6283

ue4docker/dockerfiles/ue4-source/windows/Dockerfile

+12-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ COPY ${SOURCE_LOCATION} C:\UnrealEngine
2323
# The git repository that we will clone
2424
ARG GIT_REPO=""
2525

26-
# The git branch/tag that we will checkout
26+
# The git branch/tag/commit that we will checkout
2727
ARG GIT_BRANCH=""
2828

2929
# Retrieve the address for the host that will supply git credentials
@@ -40,7 +40,17 @@ ENV GIT_ASKPASS=C:\git-credential-helper.bat
4040

4141
# Clone the UE4 git repository using the host-supplied credentials
4242
WORKDIR C:\
43-
RUN git clone --progress --depth=1 -b %GIT_BRANCH% %GIT_REPO% {{ clone_opts }} C:\UnrealEngine
43+
RUN mkdir C:\UnrealEngine && \
44+
cd C:\UnrealEngine && \
45+
git init && \
46+
{% if git_config %}
47+
{% for key, value in git_config.items() %}
48+
git config {{ key }} {{ value }} && \
49+
{% endfor %}
50+
{% endif %}
51+
git remote add origin %GIT_REPO% && \
52+
git fetch --progress --depth 1 origin %GIT_BRANCH% && \
53+
git checkout FETCH_HEAD
4454

4555
{% endif %}
4656

0 commit comments

Comments
 (0)