1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Ignore unrecognized refs in "refs/remotes/"

Summary: Ref T9028. When selecting refs, pretend refs in "refs/remotes/" that we don't otherwise recognize don't exist, since it looks like these are probably remotes //of the remote// we're observing, and who knows what state they're in.

Test Plan: Used `bin/repository discover --verbose` to verify that these named refs no longer appear in the list.

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Maniphest Tasks: T9028

Differential Revision: https://secure.phabricator.com/D16136
This commit is contained in:
epriestley 2016-06-16 15:58:07 -07:00
parent 8032a14223
commit 28eb562899

View file

@ -70,6 +70,9 @@ final class DiffusionLowLevelGitRefQuery extends DiffusionLowLevelQuery {
return array();
}
$remote_prefix = 'refs/remotes/';
$remote_len = strlen($remote_prefix);
// NOTE: Although git supports --count, we can't apply any offset or
// limit logic until the very end because we may encounter a HEAD which
// we want to discard.
@ -86,6 +89,12 @@ final class DiffusionLowLevelGitRefQuery extends DiffusionLowLevelQuery {
} else if (!strncmp($refname, $tag_prefix, $tag_len)) {
$short = substr($refname, $tag_len);
$type = $type_tag;
} else if (!strncmp($refname, $remote_prefix, $remote_len)) {
// If we've found a remote ref that we didn't recognize as naming a
// branch, just ignore it. This can happen if we're observing a remote,
// and that remote has its own remotes. We don't care about their
// state and they may be out of date, so ignore them.
continue;
} else {
$short = $refname;
$type = $type_ref;