Subject: my git problem

From: Andrew Morton <[email-masked]>
Date: Sun, 27 Apr 2008 11:29:38 -0700

git is really really bad to me during the merge window.  Let's look at an
example:

y:/usr/src/git26> cat .git/branches/git-ia64 
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6.git#test

Now, I want to generate a plain patch against mainline which will add the
patches which are in git-ia64 and which aren't in mainline.  ie: when that
patch is applied to mainline, we get git-ia64.  Sounds simple.

A naive

	git-diff origin git-ia64

generates vast amounts of stuff which is already in mainline.  Things like

 b/drivers/media/video/au0828/au0828-dvb.c       |    2 
 b/drivers/media/video/au0828/au0828-i2c.c       |    6 
 b/drivers/media/video/au0828/au0828.h           |    8 
 b/drivers/media/video/cx23885/cx23885-dvb.c     |    4 
 b/drivers/media/video/cx88/Kconfig              |    1 
 b/drivers/media/video/cx88/cx88-blackbird.c     |    6 
 b/drivers/media/video/cx88/cx88-cards.c         |    1 
 b/drivers/media/video/cx88/cx88-dvb.c           |   32 
 b/drivers/media/video/em28xx/em28xx-core.c      |    2 
 b/drivers/media/video/ir-kbd-i2c.c              |   21 
 b/drivers/media/video/pvrusb2/Kconfig           |    1 

The appended script is what I usually use.  It was worked out by Junio and
I maybe a couple of years ago. It doesn't work very well: it still generates
large numbers of changes which are already in mainline.  Some of them are
ia64 changes, some are not.

When Tony resyncs his tree with mainline this problem will correct itself. 
I drop the tree and repoll it daily until this happens.

I don't really have a bottom line here - but I would like the git
developers to be aware that what is a fairly sensible usage scenario just
doesn't seem to be satisfied at all well...

Thanks.

#!/bin/sh

GIT_TREE=/usr/src/git26
PULL=/usr/src/pull

git_header()
{
	tree="$1"
	echo GIT $(cat .git/refs/heads/$tree) $(cat .git/branches/$tree)
	echo
}

doit()
{
	tree=$1
	upstream=$2

	cd $GIT_TREE
	git reset --hard "$upstream"
	git fetch "$tree" || exit 1
	git merge --no-commit 'test merge' HEAD FETCH_HEAD > /dev/null

	{
		git_header "$tree"
		git log --no-merges ORIG_HEAD..FETCH_HEAD
		git diff --patch-with-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"
}

mkdir -p $PULL

if [ $1"x" = "-x" ]
then
	exit
fi

cd /usr/src

if [ $# == 0 ]
then
	trees=/usr/src/git-trees
else
	trees="$1"
fi

do_one()
{
	tree=$1
	upstream=$2
	if [ ! -e $PULL/$tree.patch ]
	then
		echo "*** doing $tree, based on $upstream"
		git-branch -D $tree
		doit $tree $upstream
	else
		echo skipping $tree
	fi
}
	
if [ $# == 2 ]
then
	do_one $1 $2
else
	while read x
	do
		if echo $x | grep '^#.*' > /dev/null
		then
			true
		else
			do_one $x
		fi
	done < $trees
fi