git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 7/7] Make 'stg pull' use git-fetch and not git-pull.

From
Yann Dirson <ydirson@altern.org>
Date
Jan 29, 2007, 23:05 UTC
Message-ID
<20070129230555.7102.93948.stgit@gandelf.nowhere.earth>
In-Reply-To
<20070129230117.7102.64322.stgit@gandelf.nowhere.earth>

We introduce a new pull-does-rebase setting, as companion to pullcmd. This allows to use both pullcmd's that need a rebase (like git-fetch) and pullcmd's that do not (like git-pull).

To be able to rebase, we rely on parent information being available for the stack.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 examples/gitconfig |    8 +++++++-
 stgit/config.py    |    3 ++-
 stgit/git.py       |   15 ++++++++++-----
 3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/examples/gitconfig b/examples/gitconfig
index ee68d07..60f6e85 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -33,8 +33,14 @@
 	#pager = ~/share/stgit/contrib/diffcol.sh
 	#pager = filterdiff --annotate | colordiff | less -FRX
 
-	# GIT pull command (should take the same arguments as git-pull)
+	# GIT pull command (should take the same arguments as
+	# git-fetch or git-pull).  By default:
+	#pullcmd = git-fetch
+	#pull-does-rebase = yes
+	# Alternative (old behaviour), less intuitive but maybe useful
+	# for some workflows:
 	#pullcmd = git-pull
+	#pull-does-rebase = no
 
 	# The three-way merge tool. Note that the 'output' file contains the
 	# same data as 'branch1'. This is useful for tools that do not take an
diff --git a/stgit/config.py b/stgit/config.py
index 901f600..48b4e2d 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -29,7 +29,8 @@ class GitConfig:
         'stgit.autoresolved':	'no',
         'stgit.smtpserver':	'localhost:25',
         'stgit.smtpdelay':	'5',
-        'stgit.pullcmd':	'git-pull',
+        'stgit.pullcmd':	'git-fetch',
+        'stgit.pull-does-rebase': 'yes',
         'stgit.merger':		'diff3 -L current -L ancestor -L patched -m -E ' \
 				'"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"',
         'stgit.autoimerge':	'no',
diff --git a/stgit/git.py b/stgit/git.py
index 038aaac..e30b959 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -808,18 +808,23 @@ def reset(files = None, tree_id = None, check_out = True):
         __set_head(tree_id)
 
 def pull(repository = 'origin', refspec = None):
-    """Pull changes from the remote repository. At the moment, just
-    use the 'git-pull' command
+    """Pull changes from the remote repository. Uses 'git-fetch'
+    and moves the stack base.
     """
-    # 'git-pull' updates the HEAD
+    # we update the HEAD
     __clear_head_cache()
 
     args = [repository]
     if refspec:
         args.append(refspec)
 
-    if __run(config.get('stgit.pullcmd'), args) != 0:
-        raise GitException, 'Failed "git-pull %s"' % repository
+    command = config.get('stgit.pullcmd')
+    if __run(command, args) != 0:
+        raise GitException, 'Failed "%s %s"' % (command, repository)
+
+    if (config.get('stgit.pull-does-rebase')):
+        # FIXME!
+        reset(tree_id = rev_parse(repository))
 
 def repack():
     """Repack all objects into a single pack
Previous: Yann DirsonNext: Catalin Marinas
Message 8 of 10 in “StGIT, remotes, and parent”
  1. 0/7 StGIT, remotes, and parentYann Dirson, Jan 29, 2007
  2. 1/7 Make stgit.config use git-repo-config.Yann Dirson, Jan 29, 2007
  3. 2/7 Add caching to the new config class.Yann Dirson, Jan 29, 2007
  4. 3/7 Move identification of parent branch's remote def up into stack class.Yann Dirson, Jan 29, 2007
  5. 4/7 Allows extraction of information about remotes.Yann Dirson, Jan 29, 2007
  6. 5/7 Basic support for keeping a ref to the parent branch.Yann Dirson, Jan 29, 2007
  7. 6/7 Have 'stg branch --create' record parent information.Yann Dirson, Jan 29, 2007
  8. 7/7 Make 'stg pull' use git-fetch and not git-pull.Yann Dirson, Jan 29, 2007
  9. Catalin MarinasJan 31, 2007
  10. Yann DirsonFeb 1, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.