Pier Angelo Vendrame pushed to branch tor-browser-128.7.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
b05f3350
by Beatriz Rizental at 2025-02-03T15:31:27+01:00
1 changed file:
Changes:
... | ... | @@ -4,7 +4,21 @@ |
4 | 4 | before_script:
|
5 | 5 | - git init
|
6 | 6 | - git remote add local "$LOCAL_REPO_PATH"
|
7 | - - git fetch --depth 500 local ${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
|
|
7 | + - |
|
|
8 | + # Determine the reference of the target branch in the local repository copy.
|
|
9 | + #
|
|
10 | + # 1. List all references in the local repository
|
|
11 | + # 2. Filter the references to the target branch
|
|
12 | + # 3. Remove tags
|
|
13 | + # 4. Keep a single line, in case there are too many matches
|
|
14 | + # 5. Clean up the output
|
|
15 | + # 6. Remove everything before the last two slashes, because the output is like `refs/heads/...` or `refs/remotes/...`
|
|
16 | + TARGET_BRANCH=$(git ls-remote local | grep ${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME} | grep -v 'refs/tags/' | awk '{print $2}' | tail -1 | sed 's|[^/]*/[^/]*/||')
|
|
17 | + if [ -z "$TARGET_BRANCH" ]; then
|
|
18 | + echo "Target branch $TARGET_BRANCH is not yet in local repository. Stopping the pipeline."
|
|
19 | + exit 1
|
|
20 | + fi
|
|
21 | + - git fetch --depth 500 local $TARGET_BRANCH
|
|
8 | 22 | - git remote add origin "$CI_REPOSITORY_URL"
|
9 | 23 | - |
|
10 | 24 | if [ -z "${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ]; then
|
... | ... | @@ -31,7 +45,11 @@ |
31 | 45 | if ([string]::IsNullOrEmpty($branchName)) {
|
32 | 46 | $branchName = $env:CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
33 | 47 | }
|
34 | - git fetch --depth 500 local $branchName
|
|
48 | + $TARGET_BRANCH = git ls-remote local | Select-String -Pattern $branchName | Select-String -Pattern -NotMatch 'refs/tags/' | Select-Object -Last 1 | ForEach-Object { $_.ToString().Split()[1] -replace '^[^/]*/[^/]*/', '' }
|
|
49 | + if ([string]::IsNullOrEmpty($TARGET_BRANCH)) {
|
|
50 | + Write-Output "Target branch $TARGET_BRANCH is not yet in local repository. Stopping the pipeline."
|
|
51 | + exit 1
|
|
52 | + }
|
|
35 | 53 | - git remote add origin $env:CI_REPOSITORY_URL
|
36 | 54 | - |
|
37 | 55 | $branchName = $env:CI_COMMIT_BRANCH
|