chiark / gitweb /
Better diagnostic for wrong branch configuration.
[stgit] / stgit / commands / pull.py
index 052ea2b6de47ea09d12f218bb9d137f47edf2faa..070db991a389e305f4b5a4583dd84b56f17ce51b 100644 (file)
@@ -90,7 +90,14 @@ def func(parser, options, args):
     elif policy == 'fetch-rebase':
         out.info('Fetching from "%s"' % repository)
         git.fetch(repository)
-        rebase(git.fetch_head())
+        try:
+            target = git.fetch_head()
+        except git.GitException:
+            out.error('Could not find the remote head to rebase onto, pushing any patches back...')
+            post_rebase(applied, False, False)
+            raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()
+
+        rebase(target)
     elif policy == 'rebase':
         rebase(crt_series.get_parent_branch())