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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: RFC PATCH: support for default remote in StGIT, Catalin Marinas, (Sun Dec 10, 9:41 am)
[PATCH] Check git pull remote before defaulting to 'origin', Pavel Roskin, (Tue Jan 9, 12:20 am)