git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to get a directory filled with v2.6.11?
@ 2005-07-12  5:03 Marc Singer
  2005-07-12  6:18 ` Matthias Urlichs
  2005-07-13  4:37 ` Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Singer @ 2005-07-12  5:03 UTC (permalink / raw)
  To: git

I switched to using the git version in source control.
Checkout/branching works great.  :-)

But, this version of git doesn't let me do

  # git checkout -f v2.6.11
  error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not a commit
  Needed a single revision

which I suspect is protection added to prevent my special sort of
shenanigans.  If I cannot perform the checkout anymore, is there
another way to fill a directory with the contents of that particular
tree?

What am I doing?  I've got some updates against 2.6.11 orphaned in
another develpment directory.  I could just upack a tar.bz2 file for
2.6.11, but git is more clever.  I want to perform a diff against the
tagged v2.6.11 and my development tree.

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

* Re: How to get a directory filled with v2.6.11?
  2005-07-12  5:03 How to get a directory filled with v2.6.11? Marc Singer
@ 2005-07-12  6:18 ` Matthias Urlichs
  2005-07-13  4:37 ` Linus Torvalds
  1 sibling, 0 replies; 5+ messages in thread
From: Matthias Urlichs @ 2005-07-12  6:18 UTC (permalink / raw)
  To: git

Hi, Marc Singer wrote:

> v2.6.11, 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c

You can create your own parent-less commit for that tree.
(It's what I did...)

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
"It was the most earnest ambition I ever had....Not that I ever
 really wanted to be a preacher, but because it never occurred to
 me that a preacher could be damned. It looked like a safe job."
               [Mark Twain, a Biography]

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

* Re: How to get a directory filled with v2.6.11?
  2005-07-12  5:03 How to get a directory filled with v2.6.11? Marc Singer
  2005-07-12  6:18 ` Matthias Urlichs
@ 2005-07-13  4:37 ` Linus Torvalds
  2005-07-13 20:37   ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-07-13  4:37 UTC (permalink / raw)
  To: Marc Singer; +Cc: Git Mailing List



On Mon, 11 Jul 2005, Marc Singer wrote:
>
> I switched to using the git version in source control.
> Checkout/branching works great.  :-)
> 
> But, this version of git doesn't let me do
> 
>   # git checkout -f v2.6.11
>   error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not a commit
>   Needed a single revision
> 
> which I suspect is protection added to prevent my special sort of
> shenanigans.  If I cannot perform the checkout anymore, is there
> another way to fill a directory with the contents of that particular
> tree?

Yes. Multiple ways. 

You can

 - just force that tree to be checked out:

	git-read-tree -m v2.6.11
	git-checkout-cache -f -u -a

   this basically gets you the state at the time of v2.6.11, but you still 
   don't have a _commit_ yet, so you'd have nothing to start actual 
   development from. BE CAREFUL! Your "HEAD" is now pointing to something 
   else than what you have checked out, so the next thing you want to do 
   is fix that up.

 - now, you can commit that as a _parentless_ commit (ie an "Initial
   commit") on a new branch, with something like this:

	echo "Linux 2.6.11" | git-commit-tree $(git-write-tree) > .git/refs/heads/my-branch
	ln -sf .git/HEAD refs/heads/my-branch

   and off you go. The above just creates a commit of the tree (which is 
   the v2.6.11 tree, since you did a "git-read-tree" on it), and uses the
   commit message "Linux 2.6.11"). It gives it no parents, and writes the
   result to the "my-branch" thing. It then makes HEAD point to that 
   branch, which completes the thing, and now your tree is in a consistent 
   state (ie HEAD matches what you have checked out, which matches 
   v2.6.11)

That's one way.

You can do it sneakier too, if you want to, and create the branch first. 
In particular, you can do

	git-cat-file tag v2.6.11

which will print out that tag, which starts with:

	object c39ae07f393806ccf406ef966e9a15afc43cc36a
	type tree
	tag v2.6.11-tree
	...

and now you can just do use that tree directly, without even reading it 
in:

	head=$(echo "Linux 2.6.11" | git-commit-tree c39ae07f393806ccf406ef966e9a15afc43cc36a)
	echo $head > .git/refs/heads/my-branch

which will give you the new branch.

Now you can just do

	git checkout my-branch

and you'll be there.

That said, whatever you do you will eventually end up with a series of
commits that are not related to the "normal" commits in the 2.6.12-rc2+
chain, and since they don't have a common point, git won't be able to
merge them for you. Git will be able to _track_ them for you, but at some
point you'll want to probably try to move them forward to the "rest" of
the git history.

And I'll warn you that that is not going to be entirely trivial, although
Junio's "cherrypick" scripts should be useful as a way to automate it at
least to some degree. This is why it would be so much easier if you could 
have started with a 2.6.12-rc2 or other "real" commit ;)

			Linus

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

* Re: How to get a directory filled with v2.6.11?
  2005-07-13  4:37 ` Linus Torvalds
@ 2005-07-13 20:37   ` Junio C Hamano
  2005-07-13 20:46     ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-07-13 20:37 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Linus Torvalds <torvalds@osdl.org> writes:

> That said, whatever you do you will eventually end up with a series of
> commits that are not related to the "normal" commits in the 2.6.12-rc2+
> chain, and since they don't have a common point, git won't be able to
> merge them for you. Git will be able to _track_ them for you, but at some
> point you'll want to probably try to move them forward to the "rest" of
> the git history.
>
> And I'll warn you that that is not going to be entirely trivial, although
> Junio's "cherrypick" scripts should be useful as a way to automate it at
> least to some degree. This is why it would be so much easier if you could 
> have started with a 2.6.12-rc2 or other "real" commit ;)

I do not think git-cherry would be that useful in this context.
Nobody upstream is merging things into your development trail,
started at the private commit you made based on the 2.6.11 tree.

I was wondering if adding "graft trail" to merge-base command
would help this situation.

    SYNOPSIS
    --------
    'git-merge-base' ( --graft <commit1> <commit2>)* <commit> <commit>

    ...

    OPTIONS
    -------
    <commit>::
            The two heads being merged.

    --graft <commit1> <commit2>::
            Treat as if <commit1> is one of the ancestors of
            <commit2> when computing the commit ancestry chain.
            Can be specified more than once.

Then we could say "--graft v2.6.11 v2.6.12-rc2".

We may want to have a configuration file in .git/ directory (I
think it belongs to .git/objects/ hierarchy, because this is not
per work-tree thing but per project thing) that record this
"graft" relationship.

When we have not-so-stupid [*1*] merge algorithm in place, we
could do even better.  Starting from v2.6.11 tree, we can
rebuild (from BKCVS) the development trail up to v2.6.12-rc2,
which is independent from the current kernel development trail
which started at (a different) v2.6.12-rc2.  Use the former one
as <commit1>, and the latter one as <commit2>, and the "clever"
merge algorithm would be able to follow across the v2.6.12-rc2
discontiguity and trace the development back to v2.6.11.

[Footnote]

*1* <Pine.LNX.4.58.0507052011440.3570@g5.osdl.org>

So if you want to document that the current automatic merge is stupid,
hey, go wild. It _is_ stupid. It's surprisingly effective, but that may be
because of kernel development patterns and may not be true in other
projects.

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

* Re: How to get a directory filled with v2.6.11?
  2005-07-13 20:37   ` Junio C Hamano
@ 2005-07-13 20:46     ` Linus Torvalds
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2005-07-13 20:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git



On Wed, 13 Jul 2005, Junio C Hamano wrote:
> 
> I do not think git-cherry would be that useful in this context.
> Nobody upstream is merging things into your development trail,
> started at the private commit you made based on the 2.6.11 tree.

No, the point being that he (or anybody else) could move the commits as
patches, one by one, from his 2.6.11 base to whatever later base that _is_
in the commit history.

It's really the same issue as with cherry-picking: you do commits one at a
time as diffs, see if that diff already exists in the destination stream,
and if not, you try to apply it as a patch and re-commit it with the old
commit message in a new place in history.

			Linus

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

end of thread, other threads:[~2005-07-13 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-12  5:03 How to get a directory filled with v2.6.11? Marc Singer
2005-07-12  6:18 ` Matthias Urlichs
2005-07-13  4:37 ` Linus Torvalds
2005-07-13 20:37   ` Junio C Hamano
2005-07-13 20:46     ` Linus Torvalds

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).