# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1517691275 21600
#      Sat Feb 03 14:54:35 2018 -0600
# Node ID 93cb29247d6136b5af30e52de34680232149aeef
# Parent  843f409526fbea3ffde674922b730075d5cfd4d3
exchange: check for remote refs to determine if we're cloning

The exchange.pull wrapper function was checking whether any paths were
configured yet as a proxy to determine whether we're doing the initial
clone or a subsequent pull. Core hg @ bdae51a83dfb (released in 4.5) now
sets the 'default' path on the ui object before exchange.pull is called,
but we can check a bit more directly by checking if we have any remote
refs yet. This is the same as a check we do in GitHandler.fetch_pack().

diff --git a/hggit/git_handler.py b/hggit/git_handler.py
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -298,7 +298,7 @@
 
             if remote_name:
                 self.update_remote_branches(remote_name, result.refs)
-            elif not self.paths:
+            elif not self.git.refs.as_dict('refs/remotes/'):
                 # intial cloning
                 self.update_remote_branches('default', result.refs)