Extract git_fetch_at_ref

The really dense logic in the zuulification of trees is actually
hard to understand. Extracting it into a common function makes
this much easier to understand the AND and OR logic of it.

Change-Id: I96f94da8901cd94772d1910d39b48270a45f73e6
Merge "Extract git_fetch_at_ref"