install: Use the initially-cloned repo as the base /srv/zulip.git.

This ensures that the next `upgrade-zulip-from-git` has access to the
commit history of the initial install, if it was from a forked
repository.  `/home/zulip/deployments/current` and `/srv/zulip.git`
are not quite organized into the steady-state that they will have
after one `upgrade-zulip-from-git`:
 - `/home/zulip/deployments/current` is its own clone, not a worktree
 - `/srv/zulip.git` has an origin of `/home/zulip/deployments/current`
 - `remote.origin.mirror` is set on `/srv/zulip.git`
 - `remote.origin.fetch` is `+refs/*:refs/*`

All but the first are automatically cleaned up by
`upgrade-zulip-from-git` when it is next run, using the code added in
30457ecd02.  The additional complexity of making an existing
independent clone into a worktree seem not worth solving the first
point.
This commit is contained in:
Alex Vandiver 2023-06-14 19:04:03 +00:00 committed by Tim Abbott
parent 1276653ec8
commit ec4bfd7c78
1 changed files with 3 additions and 0 deletions

View File

@ -555,6 +555,9 @@ cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static
chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py
if ! [ -e /home/zulip/deployments/current/zulip-git-version ]; then
mkdir /srv/zulip.git
chown zulip:zulip /srv/zulip.git
su zulip -c 'git clone --bare --mirror /home/zulip/deployments/current /srv/zulip.git'
su zulip -c 'cd /home/zulip/deployments/current && ./scripts/lib/update-git-upstream && ./tools/cache-zulip-git-version'
fi