Page MenuHomePhabricator

git push --mirror --force does not work on Phacility with repo that has refs/pull
Closed, ResolvedPublic

Description

I am attempting to mirror all repositories on an existing Phabricator instance over to Phacility. I have a script which does:

git clone --mirror <sourceurl> folder/
cd folder/
git push --mirror --force <desturl>

where desturl is something like: ssh://redpoint-offsite@vault.phacility.com/source/migrate-177.git. We then get:

# Push received by "web.phacility.net", forwarding to cluster host.
# Waiting up to 120 second(s) for a cluster write lock...
# Acquired write lock immediately.
# Waiting up to 120 second(s) for a cluster read lock on "repo009.phacility.net"...
# Acquired read lock immediately.
# Device "repo009.phacility.net" is already a cluster leader and does not need to be synchronized.
# Ready to receive on cluster host "repo009.phacility.net".
Counting objects: 1501, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (555/555), done.
Writing objects: 100% (1501/1501), 11.92 MiB | 2.52 MiB/s, done.
Total 1501 (delta 925), reused 1501 (delta 925)
remote: Resolving deltas: 100% (925/925), done.
remote: [2017-02-21 04:56:03] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/pull/1/head'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCom
mitHookEngine.php:404]
remote: arcanist(head=stable, ref.master=fad85844314b, ref.stable=a232e95a18f3), libcore(), phabricator(head=stable, ref.master=f844280d360c, ref.stable=3e10f69570c0), phutil(head=stable,
 ref.master=9128fb722671, ref.stable=d0ebdaf3ab70), services(head=stable, ref.master=b5cef1ac31ff, ref.stable=198eb67bd822)
remote:   #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:205]
remote:   #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:116]
remote:   #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:186]
# Released cluster write lock.
To ssh://vault.phacility.com/source/migrate-177.git
 ! [remote rejected] master -> master (pre-receive hook declined)
 ! [remote rejected] refs/pull/1/head -> refs/pull/1/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (pre-receive hook declined)
 ! [remote rejected] refs/pull/10/head -> refs/pull/10/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/11/head -> refs/pull/11/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/12/head -> refs/pull/12/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/13/head -> refs/pull/13/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/14/head -> refs/pull/14/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/15/head -> refs/pull/15/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/16/head -> refs/pull/16/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/17/head -> refs/pull/17/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/18/head -> refs/pull/18/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/19/head -> refs/pull/19/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/2/head -> refs/pull/2/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/20/head -> refs/pull/20/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/21/head -> refs/pull/21/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/22/head -> refs/pull/22/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/23/head -> refs/pull/23/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/24/head -> refs/pull/24/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/25/head -> refs/pull/25/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/26/head -> refs/pull/26/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/27/head -> refs/pull/27/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/28/head -> refs/pull/28/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/29/head -> refs/pull/29/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/30/head -> refs/pull/30/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/31/head -> refs/pull/31/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/32/head -> refs/pull/32/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/33/head -> refs/pull/33/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/34/head -> refs/pull/34/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/35/head -> refs/pull/35/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/36/head -> refs/pull/36/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/37/head -> refs/pull/37/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/38/head -> refs/pull/38/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/38/merge -> refs/pull/38/merge (pre-receive hook declined)
 ! [remote rejected] refs/pull/39/head -> refs/pull/39/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/4/head -> refs/pull/4/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/5/head -> refs/pull/5/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/6/head -> refs/pull/6/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/7/head -> refs/pull/7/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/8/head -> refs/pull/8/head (pre-receive hook declined)
 ! [remote rejected] refs/pull/9/head -> refs/pull/9/head (pre-receive hook declined)
 ! [remote rejected] latest -> latest (pre-receive hook declined)
error: failed to push some refs to 'ssh://redpoint-offsite@vault.phacility.com/source/migrate-177.git'

I'm sure I could omit the refs/pull ref tags (and instead use --all --tags). However, we intend to shut off the old Phabricator instance and I don't want to potentially lose or have to recover data from an archive. It seems reasonable to me to be able to mirror a repository from one Phabricator to another and keep all refs intact.

Reproduction Steps:

  1. Create an instance on Phacility
  2. Create a repository on Phacility
  3. git clone --mirror https://github.com/Protobuild/Protobuild.Manager
  4. cd Protobuild.Manager
  5. git push --mirror --force <desturl> where desturl is the URL of the repository you created on Phacility

Event Timeline