Skip to content

Pull doesn't work #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexspeller opened this issue Oct 2, 2011 · 8 comments
Closed

Pull doesn't work #32

alexspeller opened this issue Oct 2, 2011 · 8 comments
Milestone

Comments

@alexspeller
Copy link

g = Git.open "repo"
g.pull
# "Already up-to-date."
g.lib.send(:command, 'pull')
# "Updating 6d57a5a..0bbe197\nFast-forward\n file.rb |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)"

It looks like internally Git::Base#pull doesn't use git pull at all, but fetches and merges. Why does it not use git pull as expected? Currently it just reports it's already up to date.

@leafac
Copy link

leafac commented Dec 19, 2011

Same issue happened here!

@skrat
Copy link

skrat commented Mar 13, 2012

Same, @alexspeller thanks for the workaround, @schacon fix your cracky stone

@Rafe
Copy link

Rafe commented Mar 27, 2012

Same problems here, thanks for workaround

@kenglxn
Copy link

kenglxn commented Apr 23, 2012

Same issue here as well, @alexspeller thanks for the workaround

@jsirex
Copy link

jsirex commented Jun 6, 2012

Hi. I've debug this one.
Git does the following:
git fetch origin # problem goes here
git merge -m "Origin pull" master

Look like git requires to explicity provide branch name when fetching.
So I did the following hack. Just include this code in your project:

# Hack
module Git
  class Base
    def pull(remote = 'origin', branch = 'master', message = 'origin pull')
      fetch(remote, branch)
      merge(branch, message)
    end

    def fetch(remote = 'origin', branch = 'master')
      self.lib.fetch(remote, branch)
    end
  end

  class Lib
    def fetch(remote, branch = 'master')
      command('fetch', [remote, branch])
    end
  end
end

An update: it is not clear for me why library transforms git pull into git fetch and git merge. Deciding what is better git pull or git fetch + merge is up to user I think.

@jsirex
Copy link

jsirex commented Jun 7, 2012

It is very odd because yesterday hack above works but today it doesn't work :(
I'm trying to figure out why

Now it works and looks like:

# Hack
module Git
  class Base
    def pull
      self.lib.pull
    end
  end

  class Lib
    def pull
      command('pull')
    end
  end
end

I've decided to use directly pull command

@strathmeyer
Copy link

+1 @schacon What's the reasoning behind this? Should we submit a patch?

@anapsix
Copy link

anapsix commented May 23, 2013

👍 thanks, @robertodecurnex, solution is simple.. or and btw, B-) FIRST! :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants