git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 1.5.0.rc1.gb60d: fetch in another branch works strangely
@ 2007-01-13 21:06 Horst H. von Brand
  2007-01-13 21:14 ` Shawn O. Pearce
  2007-01-13 21:46 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Horst H. von Brand @ 2007-01-13 21:06 UTC (permalink / raw)
  To: git

I created a new branch in the kernel to carry a not yet official patch, to
keep this up to date I do:

   $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
   $ git pull . origin

The kernel repository is quite old, so it has the old-fashoned setup. I
see:

  $ less .git/refs/heads/bz-7795 
  d132ed980aee1bdcc6fa02b91da95a357902eb3c
  $ less .git/refs/heads/origin  
  d39c9400ae0d60aaaf534b1ad860a9bc1413d8af

And this last ref doesn't change when fetching.

Strangely, each time I fetch it gets 7 new objects (I haven't pulled, I do
that once I'm sure I've got all). As I tend to doubt that we are /that/
syncronized with Linus, something fishy is going on here...

First noticed this with 1.5.0.rc1.g4494.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 1.5.0.rc1.gb60d: fetch in another branch works strangely
  2007-01-13 21:06 1.5.0.rc1.gb60d: fetch in another branch works strangely Horst H. von Brand
@ 2007-01-13 21:14 ` Shawn O. Pearce
  2007-01-13 21:46 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn O. Pearce @ 2007-01-13 21:14 UTC (permalink / raw)
  To: Horst H. von Brand; +Cc: git

"Horst H. von Brand" <vonbrand@inf.utfsm.cl> wrote:
> I created a new branch in the kernel to carry a not yet official patch, to
> keep this up to date I do:
> 
>    $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

That's only writing into FETCH_HEAD whatever branch is marked as
HEAD in Linus' repository.  No local refs are being updated.

>    $ git pull . origin

So this won't merge in the changes fetched above.


Why not setup that URL as a remote (git remote add linus ....)
Then you can do:

  $ git fetch linus
  $ git merge linus/master

or 

  $ git fetch linus
  $ git pull . linus/master

or 

  $ git pull linus master

-- 
Shawn.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 1.5.0.rc1.gb60d: fetch in another branch works strangely
  2007-01-13 21:06 1.5.0.rc1.gb60d: fetch in another branch works strangely Horst H. von Brand
  2007-01-13 21:14 ` Shawn O. Pearce
@ 2007-01-13 21:46 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-01-13 21:46 UTC (permalink / raw)
  To: Horst H. von Brand; +Cc: git

"Horst H. von Brand" <vonbrand@inf.utfsm.cl> writes:

> I created a new branch in the kernel to carry a not yet official patch, to
> keep this up to date I do:
>
>    $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

If you use longhand without colon-refspec (src:dst), then the fetch
result will be in temporary ref, FETCH_HEAD.  (google, or gmane
search for a message on "temporary ref" and "FETCH_HEAD" by
Linus for gory details).  So next fetch will keep re-fetching
the same thing (this has been how "fetch" was designed to work
from day one and there is nothing new).

>    $ git pull . origin

You do not have origin tracking branch (well, you do -have- one,
but by doing the longhand without colon-refspec, you choose not
to keep it up-to-date), so that would try to merge an ancient
copy you obtained probably when you cloned to create the
repository.

You either can do:

 (1) Ad-hoc promiscuous pull without using tracking branch

     $ git pull git://git.kernel.org/...../linux-2.6.git

     This is good for one-shot pulling from random place when
     you notice somebody you usually do not interact with has
     something interesting.  I do not think you would want to do
     that with Linus.

 (2) Use remote shorthand, define and maintain tracking branch(es).

     In the traditional configuration,
     you would have .git/remotes/origin that says something
     like:

	URL: git://git.kernel.org/...../torvalds/linux-2.6.git
	Pull: refs/heads/master:refs/heads/origin

     With the newer configuration, the moral equivalent is found
     in your .git/config file and would look like something like
     this:

	[remote "origin"]
        	url = git://git.kernel.org/...../linux-2.6.git/
		fetch = +refs/heads/*:refs/remotes/origin/*
	[branch "master"]
        	merge = refs/heads/master

     In either way, you can update the tracking branch with:

     $ git fetch origin ;# or just "git fetch"

     With this, since you -do- have and -maintain- the tracking
     branch, you can do after this "git fetch":

     $ git merge origin

     to merge in what you have fetched.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-13 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-13 21:06 1.5.0.rc1.gb60d: fetch in another branch works strangely Horst H. von Brand
2007-01-13 21:14 ` Shawn O. Pearce
2007-01-13 21:46 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).