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

Re: How to not download objects more than needed?

From
Junio C Hamano <junkio@cox.net>
Date
Feb 21, 2006, 21:32 UTC
Message-ID
<7vek1wwg8d.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<43FB6C42.5000208@gorzow.mm.pl>
Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> writes:
Show 13 quoted lines
> I have a pecuilar, but common use case for git.
>
> I have linux-2.6 repository pulled and I'd like to download some branch
> (say, netdev-2.6), which uses many of the same objects,
> but not to get all the objects from the git server.
>
> I've already tried certain commands, but still can't do it,
> and my bandwidth isn't too happy about it.
>
> It seems to require some kind of HEAD rewinding,
> or maybe fetching to another branch, I don't know.
>
> Anyone cares to help?

It is not peculiar at all. The tools already should do what you want:

           o---o---o---...---o (netdev-2.6)
          /
         / < netdev forked some time ago.
        /
    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 

Suppose the "global" ancestry graph was like the above. And netdev-2.6 has not been merged into Linus tree.

What you have, already pulled from Linus, is:
    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 
And suppose what the netdev tree has is something like this:
           o---o---o---...---o (netdev-2.6)
          /
         / < netdev forked some time ago.
        /
    ---o---o---o
               ^v2.6.16-rc3

The point being that the netdev tree does not know about Linus tip you have.

When you "git fetch git://.../netdev-2.6.git/", a program that runs on your end (git-fetch-pack) and another program that runs on the other end (git-upload-pack) discuss to find out what both of you have in common. Your side starts from Linus tip and go backwards, telling the other end "I have this, I have that, ...". At first, netdev side will not see what it knows about, but after a while, it will see a commit both of you have (i.e. where the branch forked from). After they find that out, your side tells the other side "I want your netdev-2.6 head".

The other side sends the objects needed to complete the chain up to the requested head, assuming that your side has objects to complete the common ancestor point (again, the fork point, but it could be some revs after that if the graph looked like the above picture). Objects behind the fork point does not need to be sent.

Previous: Andreas Ericsson
Message 10 of 10 in “How to not download objects more than needed?”
  1. Radoslaw SzkodzinskiFeb 21, 2006
  2. seanFeb 21, 2006
  3. Linus TorvaldsFeb 22, 2006
  4. Jan HarkesFeb 22, 2006
  5. Junio C HamanoFeb 22, 2006
  6. Jan HarkesFeb 22, 2006
  7. Junio C HamanoFeb 22, 2006
  8. git-fetch: follow tag only when tracking remote branch.Junio C Hamano, Feb 22, 2006
  9. Andreas EricssonFeb 22, 2006
  10. Junio C HamanoFeb 21, 2006

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.