Skip to content

produces wrong output if `main` branch has already been converted

While converting https://salsa.debian.org/multimedia-team/fst, the following output was generated:

git branch -m master debian/latest
salsa protect_branch "${project}" master no # (intentionally fails with error 404 if branch wasn't protected)
salsa rename_branch "${project}" --source-branch=master --dest-branch=debian/latest
salsa update_repo "${project}" --rename-head --source-branch=master --dest-branch=debian/latest
git branch -m upstream upstream/latest
salsa rename_branch "${project}" --source-branch=upstream --dest-branch=temporary
salsa rename_branch "${project}" --source-branch=temporary --dest-branch=upstream/latest
git checkout debian/latest
echo "[DEFAULT]" >> debian/gbp.conf
echo "debian-branch = debian/latest" >> debian/gbp.conf
echo "upstream-branch = upstream/latest" >> debian/gbp.conf
git commit -a -m "Update git repository layout to follow DEP-14"
git pull --prune

I manually ran the first 4 commands (converting the master branch to debian/latest).

then I decided to run dep-14-convert-git-branch-names again. the new output is

git branch -m upstream upstream/latest
git checkout debian/latest
echo "[DEFAULT]" >> debian/gbp.conf
echo "debian-branch = debian/latest" >> debian/gbp.conf
echo "upstream-branch = upstream/latest" >> debian/gbp.conf
git commit -a -m "Update git repository layout to follow DEP-14"

as can be seen, this misses conversion of upstream to upstream/latest on the remote:

salsa rename_branch "${project}" --source-branch=upstream --dest-branch=temporary
salsa rename_branch "${project}" --source-branch=temporary --dest-branch=upstream/latest
git checkout debian/latest