Skip to content

preserve branch information for checkouts

What does this MR do?

Preserve branch information for checkouts.

Why was this MR needed?

This patch adds -B branchname to checkout.

This is needed for tools that rely on branch information that gets lost with the current git checkout hash.

it's basically the same as running:

  1. git checkout branchname
  2. git reset --hard hash

https://github.com/composer/composer/issues/5432#issuecomment-255669875

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

Theoretically there may need to check if the remote branchname still exists when the build is ran. Perhaps the runner was offline for a while and the time the job actually gets run developer has removed the branch on remote.

It's probably very rare situation and current solution would behave even better replicating scenario when the commit was made.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

Merge request reports

Loading