Allow the git-pull command to be configurable
[stgit] / stgit / git.py
index 2c73bb8..43bdc7e 100644 (file)
@@ -22,6 +22,7 @@ import sys, os, popen2, re, gitmergeonefile
 
 from stgit import basedir
 from stgit.utils import *
+from stgit.config import config
 
 # git exception class
 class GitException(Exception):
@@ -59,7 +60,11 @@ class Commit:
         return self.__tree
 
     def get_parent(self):
-        return self.get_parents()[0]
+        parents = self.get_parents()
+        if parents:
+            return parents[0]
+        else:
+            return None
 
     def get_parents(self):
         return _output_lines('git-rev-list --parents --max-count=1 %s'
@@ -687,7 +692,7 @@ def pull(repository = 'origin', refspec = None):
     if refspec:
         args.append(refspec)
 
-    if __run('git-pull', args) != 0:
+    if __run(config.get('stgit', 'pullcmd'), args) != 0:
         raise GitException, 'Failed "git-pull %s"' % repository
 
 def apply_patch(filename = None, base = None):