threads / discuss / 2405

Diff between the non-head git work dir and non-git kernel sources

Subject: Diff between the non-head git work dir and non-git kernel sources

## tl;dr

3 messages between Nov 8, 2005 and Nov 8, 2005.

replies: 2people: 2as markdown or json

lamikr· Nov 8, 2005, 20:54 UTC · lore
Hi

I am sorry if this a newbie question, but I have tried to read howtos from the web without finding clear documentation or howto to following kind of problem.

I have checked out the omap git tree with command
    git-clone rsync://source.mvista.com/git/linux-omap-2.6.git 
linux-omap-2.6

and now I am obviously having the omap kernel head in the linux-omap-2.6 working directory + hidden ".git" with commit history. In addition I have my own "non git" development tree that is made on top of traditional kernel snapshots. I however know that the sources in this dir reflects to state in git history when following patch was committed

    
http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=commitdiff;h=d24aff0bd3e788d69a45a9d1b1eecda88d847a41

I would now like to revert the sources in git working dir to state that was after this d24aff0bd3e788d69a45a9d1b1eecda88d847a41 commit and then make the diff between that kernel source version and my non-git source version and I am now trying to find out what is the "correct" way of doing this.

1) If understood the documentation correctly I could move the working 
dir to contain the state after
d24aff0bd3e788d69a45a9d1b1eecda88d847a41 commit in a following way
a) open qgit and mark correct commit with "make tag mytag" command
b) change the files in working dir to be same than during the "mytag" 
commit time by using command git checkout -f mytag
   
Are there simpler method for doing this that uses commit id 
d24aff0bd3e788d69a45a9d1b1eecda88d847a41 directly without need to make 
tag or branch?
2) Does git-diff support making the diff between git's working dir and 
"my non" git kernel source dir.
Or should I just just use normal diff and order that to ignore .git dir 
and .gitignore files?
Mika
Junio C Hamano· Nov 8, 2005, 22:18 UTC · re: lamikr · lore

Re: Diff between the non-head git work dir and non-git kernel sources

lamikr <lamikr@cc.jyu.fi> writes:

Let me understand what trees are involved. I am not sure from your description.

 1. You based your own development on some kernel snapshot.
 2. The kernel snapshot you based 1. is "some version".
 3. Mvista has d24aff0b commit that contains their changes to
    a kernel snapshot (the same "some version" as 2).
 4. Mvista now has different version, descendant of 3.  This is
    the top of omap tree you cloned.
         --------------------------->[2] yours
        /
     [1]------------->[3]----------->[4] omap tip
Is this the commit history graph you have?
> I would now like to revert the sources in git working dir to state that 
> was after this d24aff0bd3e788d69a45a9d1b1eecda88d847a41 commit
> and then make the diff between that kernel source version and my non-git 
> source version.

You lost me here. Presumably the ultimate goal of what you are doing is either one of the following:

(1) port your good changes between [1] and [2] on top of [4], or
(2) port progresses in omap tree between [3] and [4] (or perhaps
    [1] and [4], including changes betwen [1] and [3]) on top of
    your tree [2].

But I am not sure what you mean by the above paragraph. You sound as if you want to find out the differences between [3] ("revert it to d24aff") and [2] ("your non-git source").

If that is what you want instead, assuming you have your kernel tree in linux-lamikr and omap tree in linux-omap:

	$ cd linux-omap
        $ git checkout -b snapshot-d24aff0b d24aff0b
	$ cd ..
	$ diff -ru -X linux-lamikr/Documentation/dontdiff \
        	linux-omap linux-lamikr

would give you the diff between [3] and [2]; if the difference between [1] and [3] is insignificant, then that diff can be applied to [4]. However, if you have much stuff going on between [1] and [2], applying "single diff containing everything" may turn out to be not so useful.

> 2) Does git-diff support making the diff between git's working dir and 
> "my non" git kernel source dir.
> Or should I just just use normal diff and order that to ignore .git dir 
> and .gitignore files?

Another possibility would be to move your development to .git; if you know the commit id of [1], then you can branch from that commit and replay your development trail step by step up to [2]. This obviously requires that you used some SCM to keep track your development trail between [1] and [2].

Once you have done that (and assuming your branch is called lamikr), you could compare omap and your tip with:

	$ git checkout lamikr
	$ git diff lamikr origin
Or even merge omap tip into your branch:
	$ git checkout lamikr
	$ git pull . origin
all inside linux-omap/ directory.
lamikr· Nov 8, 2005, 23:52 UTC · re: Junio C Hamano · lore

Re: Diff between the non-head git work dir and non-git kernel sources

Junio, thanks for the help, I think the problems are now vanished :-)
Junio C Hamano wrote:
Show 22 quoted lines
>lamikr <lamikr@cc.jyu.fi> writes:
>
>Let me understand what trees are involved.  I am not sure from
>your description.
>
> 1. You based your own development on some kernel snapshot.
>
> 2. The kernel snapshot you based 1. is "some version".
>
> 3. Mvista has d24aff0b commit that contains their changes to
>    a kernel snapshot (the same "some version" as 2).
>
> 4. Mvista now has different version, descendant of 3.  This is
>    the top of omap tree you cloned.
>
>         --------------------------->[2] yours
>        /
>     [1]------------->[3]----------->[4] omap tip
>
>Is this the commit history graph you have?
>  
>
Almost like this.
a) I used 2.6.14-rc5.tar.bz2 as a base
b) Then I applied
       2.6.14-rc5.tar.bz2 and 
http://www.muru.com/linux/omap/patches/patch-2.6.14-rc5-omap1.bz2
    on top of that. This is a snapshot from the OMAP git tree.   [1]
c) I merged my own development to these sources --> [2]
d) I manually applied all patches released to omap tree between 
patch-2.6.14-rc5-omap1.bz2 and
commit-id d24aff0bd3e788d69a45a9d1b1eecda88d847a41   --> [5]

So the relation between kernel version [5] that I have in non git tree is basically following and current omap git tree is following kind.

         ---my changes-->[2]----->[5] my source tree (non git)
        /                         /
     [1]----------------------->[3]---------->[4] omap git (currently in 2.6.14 level)

I needed to change git working directory from state [4] to state [3] so that I could create the diff between [3] and [5]. (And then try to merge it back on top of [4]...)

Show 13 quoted lines
>>I would now like to revert the sources in git working dir to state that 
>>was after this d24aff0bd3e788d69a45a9d1b1eecda88d847a41 commit
>>and then make the diff between that kernel source version and my non-git 
>>source version.
>>    
>>
>
>You lost me here.  Presumably the ultimate goal of what you are
>doing is either one of the following:
>
>(1) port your good changes between [1] and [2] on top of [4], or
>  
>

Yes, my goal is to have in future a own local git branch that follows mvistas git tree. (and mvistas tree follows mainline) For this I have found good looking documentation.

Show 15 quoted lines
>(2) port progresses in omap tree between [3] and [4] (or perhaps
>    [1] and [4], including changes betwen [1] and [3]) on top of
>    your tree [2].
>
>But I am not sure what you mean by the above paragraph.  You
>sound as if you want to find out the differences between [3]
>("revert it to d24aff") and [2] ("your non-git source").
>
>If that is what you want instead, assuming you have your kernel
>tree in linux-lamikr and omap tree in linux-omap:
>
>	$ cd linux-omap
>        $ git checkout -b snapshot-d24aff0b d24aff0b
>  
>

This was the thing I wanted to know and it worked. I made something wrong in my own attempts and I always failed to revert to own version. (Propaply because I tried to create tag names)

Show 20 quoted lines
>Another possibility would be to move your development to .git;
>if you know the commit id of [1], then you can branch from that
>commit and replay your development trail step by step up to [2].
>This obviously requires that you used some SCM to keep track
>your development trail between [1] and [2].
>
>Once you have done that (and assuming your branch is called
>lamikr), you could compare omap and your tip with:
>
>	$ git checkout lamikr
>	$ git diff lamikr origin
>
>Or even merge omap tip into your branch:
>
>	$ git checkout lamikr
>	$ git pull . origin
>
>all inside linux-omap/ directory.
>  
>

Well, I already started diff running in the background by using the first solution but I will also try this one for the comparison.

Mika

← back to recent threads