Re: Re: Kernel SCM saga..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 9, 2005 3:53 AM, Petr Baudis <[email protected]> wrote:

>   FWIW, I made few small fixes (to prevent some trivial usage errors to
> cause cache corruption) and added scripts gitcommit.sh, gitadd.sh and
> gitlog.sh - heavily inspired by what already went through the mailing
> list. Everything is available at http://pasky.or.cz/~pasky/dev/git/
> (including .dircache, even though it isn't shown in the index), the
> cumulative patch can be found below. The scripts aim to provide some
> (obviously very interim) more high-level interface for git.

I did a bit of playing about with the changelog generate script,
trying to produce a faster version.  The attached version uses a
couple of improvements to be a lot faster (e.g. no recursion in the
common case of one parent).

FWIW it is 7x faster than makechlog.sh (4.342 secs vs 34.129 secs) and
28x faster than gitlog.sh (4.342 secs vs 2 mins 4 secs) on my
hardware.  You mileage may of course vary.

Regards

Phillip

--------------------------------------
#!/bin/sh

changelog() {
        local parents new_parent
        declare -a new_parent

        new_parent[0]=$1
        parents=1

        while [ $parents -gt 0 ]; do
                parent=${new_parent[$((parents-1))]}
                echo $parent >> $TMP
                cat-file commit $parent > $TMP_FILE

                echo me $parent
                cat $TMP_FILE
                echo -e "\n--------------------------\n"

                parents=0
                while read type text; do
                        if [ $type = 'committer' ]; then
                                break;
                        elif [ $type = 'parent' ] &&
                                        ! grep -q $text $TMP ; then
                                new_parent[$parents]=$text
                                parents=$((parents+1))
                        fi
                done < $TMP_FILE

                i=0
                while [ $i -lt $((parents-1)) ]; do
                        changelog ${new_parent[$i]}
                        i=$((i+1))
                done
        done
}

TMP=`mktemp`
TMP_FILE=`mktemp`

base=$1
if [ ! "$base" ]; then
        base=$(cat .dircache/HEAD)
fi
changelog $base
rm -rf $TMP $TMP_FILE
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux