Re: my git problem
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Apr 28, 2008, 21:47 UTC
- Message-ID
- <alpine.LFD.1.10.0804281437160.3119@woody.linux-foundation.org>
- In-Reply-To
- <20080428143501.7d6e3ad0.akpm@linux-foundation.org>
On Mon, 28 Apr 2008, Andrew Morton wrote:
Show 20 quoted lines
> > origin.patch (generated via git-diff v2.6.25...origin) has: > > commit 7f424a8b08c26dc14ac5c17164014539ac9a5c65 > Author: Peter Zijlstra <peterz@infradead.org> > Date: Fri Apr 25 17:39:01 2008 +0200 > > fix idle (arch, acpi and apm) and lockdep > > > and git-x86 (generated via git-diff origin...git-x86) has: > > commit 0a1679501624482a06c19af49d55b68d3973e2f0 > Author: Peter Zijlstra <peterz@infradead.org> > Date: Fri Apr 25 17:39:01 2008 +0200 > > fix idle (arch, acpi and apm) and lockdep > > > which I assume is the same patch as a different commit.
Yes.
So this is an example of the fact that that patch was merged in two different trees as separate patches, so when you do
git diff origin..git-x86
then it shows literally the diff from the last common state, and does *not* take into account that since that last common state there has been updates to the origin branch that essentially conflict (and in this case trivially, by just duplicating the work).
> The old `doit' prevented that by doing a merge.
Yes. And it sounds like what you want is that merge, followed by the diff. You're not actually asking for "what has changed since the last common state". You are literally asking for "what would a merge result in".
> git-diff was "wrong" to claim that this change is actually present in the > origin->git-x86 diff. But I guess it cannot operate at that level and we > need to do the merge to resolve it. Or something.
I don't actually see what was wrong with the old script. The merge was really oddly done, but apart from that, something like this should work (just your old script with some trivial fixes to 'git merge' and using somewhat saner arguments):
doit()
{
tree=$1
upstream=$2
cd $GIT_TREE
git reset --hard "$upstream"
git fetch "$tree" || exit 1
git merge --no-commit FETCH_HEAD > /dev/null
{
git_header "$tree"
git shortlog --no-merges ORIG_HEAD..FETCH_HEAD
git diff -p --stat ORIG_HEAD
} >$PULL/$tree.patch {
echo DESC
echo $tree.patch
echo EDESC
git_header "$tree"
git log --no-merges ORIG_HEAD..FETCH_HEAD
} >$PULL/$tree.txt
git reset --hard "$upstream"
}but obviously that will still result in problems if there are real conflicts.
Linus