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

Re: Apply git bundle to source tree?

From
AGAndreas Grünbacher <andreas.gruenbacher@gmail.com>
Date
Sep 18, 2020, 20:00 UTC
Message-ID
<CAHpGcMLEtuKAi1xeaAaC0pMi+mn3wuYVtg0zT4VqJuRHtVHVoA@mail.gmail.com>
In-Reply-To
<xmqqbli3nlda.fsf@gitster.c.googlers.com>
Am Fr., 18. Sept. 2020 um 17:41 Uhr schrieb Junio C Hamano <gitster@pobox.com>:
Show 37 quoted lines
> Andreas Grünbacher <andreas.gruenbacher@gmail.com> writes:
> > I'm wondering if there's a way to apply a particular head in a bundle
> > to a source tree, for example:
> >
> >   $ git bundle create v5.9-rc1.bundle v5.8..v5.9-rc1
> >   $ cd linux-5.8
> >   $ git bundle APPLY ../5.9-rc1.bundle v5.9-rc1
> >
> > That would allow to reconstruct either the original repository or just
> > the underlying source tree, so the bundle could be used as a kind of
> > super diff.
>
> There seem to be a bit of misconception.
>
> Do not think that a bundle is like a patch.  When you created the
> bundle in the above example, you did not create a "super diff"
> between v5.8 and v5.9-rc1 that you can apply to a working tree files
> that correspond to v5.8 release.  That is not what you did.
>
> What you created is an equivalent of a (shallow) repository, that
> contains everything needed to get v5.9-rc1 by those who have a Git
> repository that has v5.8 to fetch/pull from.  It is OK to have more,
> but you MUST have v5.8 for the bundle in the example to be usable.
>
> So assuming that your 'linux-5.8' is not just a tarball extract but
> a Linux repository with v5.8 tag in it (i.e. "git log v5.8" gives
> you sensible output) then the command to use is not apply but fetch,
> e.g.
>
>     $ git bundle fetch ../5.9-rc1.bundle v5.9-rc1
>
> which will give you v5.9-rc1 tag.  What you can fetch from the bundle
> can be listed by using the list-heads subcommand on the bundle.
>
> And starting from that point, you would be able to do things like
>
>     $ git checkout -b my-fork-of-5.9-rc1 v5.9-rc1
Yes thanks, that's roughly what I could infer from the man page.
Show 9 quoted lines
> Now, assuming that your original question indeed came from thinking
> of a bundle like a patch and not like a repository, we have a
> question for you.  What in
>
>     $ git bundle --help
>
> gave such an incorrect impression? The documentation must be at
> fault here, and we need to clarify so that future readers of it will
> not be confused into the same misconception.

I think the documentation is fine, nothing in it indicates that what I'm looking for is supported. That's why I was asking if it's possible to reconstruct the v5.9-rc1 source tree from the v5.8 source tree plus a v5.8..v5.9-rc1 bundle at least theoretically.

Poking a little further, I see that the bundle depends on v5.8 and all the ancestor commits of v5.8 that were merged into v5.9-rc1, which only makes sense now. The bundle doesn't contain any of the objects coming from those commits, so there's simply not enough information there for what I was trying to achieve.

Thanks, Andreas

Previous: Junio C HamanoNext: Konstantin Ryabitsev
Message 10 of 14 in “Apply git bundle to source tree?”
  1. Andreas GrünbacherSep 18, 2020
  2. Taylor BlauSep 18, 2020
  3. Andreas GrünbacherSep 18, 2020
  4. Taylor BlauSep 18, 2020
  5. Andreas GrünbacherSep 18, 2020
  6. Andreas SchwabSep 18, 2020
  7. Andreas GrünbacherSep 18, 2020
  8. Andreas SchwabSep 18, 2020
  9. Junio C HamanoSep 18, 2020
  10. Andreas GrünbacherSep 18, 2020
  11. Konstantin RyabitsevSep 18, 2020
  12. Andreas GrünbacherSep 18, 2020
  13. Thomas Guyot-SionnestSep 19, 2020
  14. brian m. carlsonSep 19, 2020

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.