[jhbuild] [git] extra check of git repository when current branch couldn't be found



commit 60556470ceb7a03368a45a5423ff027f4cd9c8e1
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Aug 11 10:47:10 2009 +0200

    [git] extra check of git repository when current branch couldn't be found
    
    Aborted git clone could leave a directory with a skeleton .git/ that would be
    accepted by jhbuild, but would lead to disasters later on (as the repository
    would be missing files), detect the situation and abort with an error message,
    to let the user clean things up.  (GNOME bug 590273)

 jhbuild/versioncontrol/git.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index edd7f69..1d5d911 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -284,6 +284,14 @@ class GitBranch(Branch):
                             **git_extra_args)
 
         current_branch = self.get_current_branch()
+        if current_branch is None:
+            # things are getting out of hand, check the git repository is
+            # correct
+            try:
+                get_output(['git', 'show'], **git_extra_args)
+            except CommandError:
+                raise CommandError(_('Failed to update module (corrupt .git?)'))
+
         if current_branch not in ('(no branch)', None):
             buildscript.execute(['git', 'pull', '--rebase'], **git_extra_args)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]