openedx-unsupported/devstack

make dev.clone.ssh errors when using repository forks

rgraber opened this issue · 1 comments

Running make dev.clone.ssh results in fatal: ref refs/remotes/origin/HEAD is not a symbolic ref if you are working on a fork for any one of the devstack services. This is particularly problematic for repositories like course-discovery, where most people don't have write access and thus have to work on forks for development.
This also hinders running update-dbs-init-sql-scripts.sh because that calls make dev.clone.ssh

The place for the fix seems to be in _checkout_and_update_branch. Changing CHECKOUT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed -E 's@^refs/remotes/(upstream|origin)/@@') to CHECKOUT_BRANCH=$((git symbolic-ref refs/remotes/origin/HEAD || git symbolic-ref refs/remotes/upstream/HEAD) | sed -E 's@^refs/remotes/(upstream|origin)/@@') resolves the immediate issue but causes problem if one of the forked repositories is on a branch besides master. I think to fix it completely we have to determine for everything whether we want to fetch from origin or upstream.