[PATCH] Check git pull remote before defaulting to 'origin'

Previous thread: Re: Using GIT to store /etc (Or: How to make GIT store all file permission bits) by Jakub Narebski on Sunday, December 10, 2006 - 8:30 am. (9 messages)

Next thread: Re: Collection of stgit issues and wishes by Jakub Narebski on Sunday, December 10, 2006 - 10:01 am. (8 messages)
From: Catalin Marinas
Date: Sunday, December 10, 2006 - 9:41 am

Yann started a thread on this but I didn't find the time to look at
this properly. He's idea was to store the remote branch information in
the StGIT metadata but I'd like to leave this for GIT to deal with.

The StGIT UI can probably be modified to display something useful but

With the recent changes, StGIT shares the config files with GIT and it
has direct access to git settings without the need to use
git-repo-config. Just use "config.has_key" and "config.get_option".

Maybe a combination of your two options - StGIT could try to get the
default branch and, if there isn't any in the config files, just
invoke git-pull without any argument (and display something like
"pulling from default").

-- 
Catalin
-

From: Pavel Roskin
Date: Tuesday, January 9, 2007 - 12:20 am

Check git pull remote before defaulting to 'origin'

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 stgit/commands/pull.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 227249e..7c5db22 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -50,10 +50,16 @@ def func(parser, options, args):
     if len(args) > 2:
         parser.error('incorrect number of arguments')
 
-    repository = 'origin'
-    refspec = None
     if len(args) >= 1:
         repository = args[0]
+    else:
+        section = 'branch "%s"' % git.get_head_file()
+        if config.has_option(section, 'remote'):
+            repository = config.get(section, 'remote')
+        else:
+            repository = 'origin'
+
+    refspec = None
     if len(args) == 2:
         refspec = args[1]
 

-- 
Regards,
Pavel Roskin


-

From: Catalin Marinas
Date: Tuesday, January 9, 2007 - 3:30 am

Thanks. Applied.

-- 
Catalin
-

Previous thread: Re: Using GIT to store /etc (Or: How to make GIT store all file permission bits) by Jakub Narebski on Sunday, December 10, 2006 - 8:30 am. (9 messages)

Next thread: Re: Collection of stgit issues and wishes by Jakub Narebski on Sunday, December 10, 2006 - 10:01 am. (8 messages)