Skip to content

Fetch code from provided refspecs

What does this MR do?

response on POST jobs/request

{
  "id": 6509,
  "token": "wyDuqzKsDPDeB67EWDJv",
  "allow_git_fetch": true,
  "job_info": {
    "name": "build",
    "stage": "test",
    "project_id": 89,
    "project_name": "prospective-merge-pipelines"
  },
  "git_info": {
    "repo_url": "http://gitlab-ci-token:wyDuqzKsDPDeB67EWDJv@localhost:8181/root/prospective-merge-pipelines.git",
    "sha": "0a7ad82032b422f591cbf915f1ad6634cd931497",
    "before_sha": "0000000000000000000000000000000000000000",
    "ref": "refs/merge-requests/1/head",
    "ref_type": "merge_request",
    "refspecs": ["+refs/merge_requests/6509/merge:refs/origin/merge_requests/6509/merge", "+refs/merge_requests/6509/head:refs/origin/merge_requests/6509/head"],
    "depth": 1
  },
  // ...
}

with the new respecs instead of clone/fetch, we always do the following:

  1. if clone delete the project directory
  2. git init
  3. git remote set-url origin
  4. git fetch origin origin --prune refspecs

Why was this MR needed?

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Closes #3983 (closed)

Edited by Alessio Caiazza

Merge request reports