Verified Commit 33bf76de authored by Camil Staps's avatar Camil Staps
Browse files

Use git rev-list --first-parent when checking out git repositories when CLEANDATE is set

This way we only check out a previous state of the requested branch.
For example, if the history looks like:

* (merge) commit 4
|\
| * commit 3
| |
| * commit 2
|/
* commit 1

If a commit before 3 is requested, previously, commit 2 would be
selected. With --first-parent, we only follow the left path, and commit
1 is selected. This avoids checking out the intermediate state on a
feature branch.
parent 228dcbb4
Pipeline #49795 passed with stage
in 13 minutes and 6 seconds
...@@ -36,7 +36,7 @@ if [ -e $PACKAGE/$OS-$ARCH/git-sources.txt ]; then ...@@ -36,7 +36,7 @@ if [ -e $PACKAGE/$OS-$ARCH/git-sources.txt ]; then
if [ -n "${CLEANDATE+set}" ]; then if [ -n "${CLEANDATE+set}" ]; then
git clone -b $branch $GIT_BASEURL/$group/$repo.git src/$repo-$branch git clone -b $branch $GIT_BASEURL/$group/$repo.git src/$repo-$branch
(cd src/$repo-$branch (cd src/$repo-$branch
git checkout `git rev-list -n 1 --before="$CLEANDATE" $branch` git checkout `git rev-list -n 1 --first-parent --before="$CLEANDATE" $branch`
git submodule update --init --recursive) git submodule update --init --recursive)
else else
git clone --recursive -b $branch $GIT_BASEURL/$group/$repo.git src/$repo-$branch git clone --recursive -b $branch $GIT_BASEURL/$group/$repo.git src/$repo-$branch
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment