Page MenuHomePhabricator

Mirroring an empty repository causes errors in the daemon log every minute.
Closed, ResolvedPublic

Description

If you set up a mirror on an empty repository, every minute when it tries to push to the mirror it gets an error.

1[2014-08-20 16:51:32] PHLOG: 'Unexpected output while updating repository "rACC": [2014-08-20 16:51:32] EXCEPTION: (PhutilProxyException) Error while pushing "ACC" repository to mirrors. {>} (PhutilAggregateException) Exceptions occurred while mirroring the "ACC" repository.
2 - CommandException: Command failed with error #1!
3 COMMAND
4 git push --verbose --mirror -- 'xxxxx'
5
6 STDOUT
7 (empty)
8
9 STDERR
10 Pushing to ssh://******/~/repositories/Accounting
11 Warning: Permanently added '*****,*****' (RSA) to the list of known hosts.
12 No refs in common and none specified; doing nothing.
13 Perhaps you should specify a branch such as 'master'.
14 fatal: The remote end hung up unexpectedly
15 error: failed to push some refs to 'ssh://*****/~/repositories/Accounting'
16 at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php:31]
17 #0 PhabricatorRepositoryMirrorEngine::pu...' at [/opt/phabricator/phabricator/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php:345]
18 #0 phlog(string) called at [<phabricator>/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php:345]
19 #1 PhabricatorRepositoryPullLocalDaemon::resolveUpdateFuture(PhabricatorRepository, ExecFuture, integer) called at [<phabricator>/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php:198]
20 #2 PhabricatorRepositoryPullLocalDaemon::run() called at [<phutil>/src/daemon/PhutilDaemon.php:84]
21 #3 PhutilDaemon::execute() called at [<phutil>/scripts/daemon/exec/exec_daemon.php:111]

Specifically:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly

This makes sense, since both are empty, there is nothing in common and git should return an error, but it would be nice if Phabricator handled this case.

I'm not positive how to implement this in a way that it wouldn't silence actual errors though. Perhaps before we mirror, we could check if we actually have any commits, and if we don't, don't try to push to the mirror.