Skip to content

git: vcs import by hash does not work for hashes not in local history #258

@timor-raiman

Description

@timor-raiman

Run the following to reproduce:

git clone git@github.com:timor-raiman/action-ros-ci.git -b vcs-issue && cd action-ros-ci
git fetch origin +refs/pull/3/*:refs/remotes/origin/pr/3/*
export PRMERGE_SHA=`git rev-parse origin/pr/3/merge`
rm -rf new-path/ && mkdir -p new-path/
cat test-vcs-issue.repo | envsubst | vcs import --force --recursive new-path/

Explanation:
vcs does not fetch the git commits corresponding to pull requests (unless it has access to the source branch and we are interested in /head rather than /merge)

Solution:
Given the desired version is a commit hash, vcs should first run git fetch origin <the hash> before attempting to checkout the hash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions