Re: q: faster way to integrate/merge lots of topic branches?
- From
- Ingo Molnar <mingo@elte.hu>
- Date
- Jul 23, 2008, 14:56 UTC
- Message-ID
- <20080723145622.GA23440@elte.hu>
- In-Reply-To
- <76718490807230747w5d0350b8v6feba00fb8837617@mail.gmail.com>
* Jay Soffian <jaysoffian@gmail.com> wrote:
Show 9 quoted lines
> > CACHE=$MERGECACHE/$HEAD_SHA1/$BRANCH_SHA1
> >
> > [ -f "$CACHE" -a "$CACHE" -nt .git/refs/heads/$BRANCH_SHA1 ] && {
>
> Shouldn't this be:
>
> [ -f "$CACHE" -a "$CACHE" -nt .git/refs/heads/$BRANCH ] && {
>
> ?yeah, i just figured it out too ... the hard way :)
Updated script below. This works fine across resets in the master branch.
While it's fast in the empty-merge case, it's not as fast as i'd like it to be in the almost-empty-merge case.
Ingo
--------------{ git-fastmerge }--------------------> #!/bin/bash
usage () {
echo 'usage: tip-fastmerge <refspec>..'
exit -1
}[ $# = 0 ] && usage
BRANCH=$1
MERGECACHE=.git/mergecache
[ ! -d $MERGECACHE ] && { mkdir $MERGECACHE || usage; }HEADREF=.git/$(cut -d' ' -f2 .git/HEAD)
HEAD_SHA1=$(git-log -1 --pretty=format:"%H") BRANCH_SHA1=$(git-log -1 --pretty=format:"%H" $BRANCH)
CACHE=$MERGECACHE/$HEAD_SHA1/$BRANCH_SHA1
[ -f "$CACHE" -a "$CACHE" -nt "$HEADREF" ] && {
# echo "merge-cache hit on HEAD <= $1"
exit 0
}git-merge $1 && {
mkdir -p $(dirname $CACHE)
touch $CACHE
}