@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't try to prune unreachable commits from repositories with no outdated refs

Summary:
Fixes T11269. The basic issue is that `git log` in an empty repository exits with an error message.

Prior to recent Git (2.6?), this message reads:

> fatal: bad default revision 'HEAD'

This message was somewhat recently changed by <https://github.com/git/git/commit/ce113604672fed9b429b1c162b1005794fff6a17>. After that, it reads:

> fatal: your current branch 'master' does not have any commits yet

This change isn't //technically// a //complete// fix because you could still hit this issue like this:

- Create an empty repository.
- Push some stuff to `master`.
- Delete `master`.

However, this is very rare and even in this case the repository will fix itself once you push something again. We can try to fix that if any users ever actually hit it.

Test Plan:
- Created a new empty Git repository.
- Ran `bin/repository update Rxx`.
- Before patch: "git log" error because of the empty repository.
- After patch: clean update.
- Also ran `repository update` on a non-empty repository.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11269

Differential Revision: https://secure.phabricator.com/D16234

+7
+7
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 759 759 'repositoryPHID = %s', 760 760 $repository->getPHID()); 761 761 762 + // If we don't have any refs to update, bail out before building a graph 763 + // stream. In particular, this improves behavior in empty repositories, 764 + // where `git log` exits with an error. 765 + if (!$old_refs) { 766 + return; 767 + } 768 + 762 769 // We can share a single graph stream across all the checks we need to do. 763 770 $stream = new PhabricatorGitGraphStream($repository); 764 771