Re: Apply git bundle to source tree?
- From
- Andreas 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