git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH] Better diagnostic for wrong branch configuration.
Date: Fri, 05 Oct 2007 22:44:52 +0200	[thread overview]
Message-ID: <20071005204452.30902.60246.stgit@gandelf.nowhere.earth> (raw)

If the branch.*.merge parameter does not name a valid remote head,
stgit would not rebase after a fetch, and would write instead
'Rebasing to "None" ... done'.

This patch makes this situation an error and tells the user what
to fix in his repo configuration.
---

 stgit/commands/pull.py |    9 ++++++++-
 stgit/git.py           |    5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 052ea2b..070db99 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -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())
 
diff --git a/stgit/git.py b/stgit/git.py
index 9e0f771..a0493bc 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -1003,11 +1003,14 @@ def fetch_head():
         m = re.match('^([^\t]*)\t\t', line)
         if m:
             if fetch_head:
-                raise GitException, "StGit does not support multiple FETCH_HEAD"
+                raise GitException, 'StGit does not support multiple FETCH_HEAD'
             else:
                 fetch_head=m.group(1)
     stream.close()
 
+    if not fetch_head:
+        raise GitException, 'No for-merge remote head found in FETCH_HEAD'
+
     # here we are sure to have a single fetch_head
     return fetch_head
 

             reply	other threads:[~2007-10-05 20:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 20:44 Yann Dirson [this message]
2007-10-07 13:14 ` [StGIT PATCH] Better diagnostic for wrong branch configuration Karl Hasselström
2007-10-07 14:17   ` Yann Dirson
2007-10-07 15:25     ` Karl Hasselström
2007-10-07 21:04 ` Catalin Marinas
2007-10-08 13:00 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071005204452.30902.60246.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).