finding similar blobs (was: Re: $Revision$ keyword replacement?

From: Junio C Hamano <junkio@cox.net>
Date: 2005-11-23 09:42:07
Santi Béjar <sbejar@gmail.com> writes:

>         How similar this file is to the file $path in these commit(s)?

Very cute.

> tmp=`mktemp -t -d git-find-sim.XXXXXXX`
> ...
> git update-index --add $file || exit 1
> tree=`git-write-tree`

Are you going through all this trouble just to avoid a blob and
a tree object left dangling after you are done?  Or is there
something else going on?

> rev_arg=`GIT_DIR=$GIT_DIR_ORIG git-rev-parse --default HEAD --revs-only "$@"`
> revs=`GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg`
> for i in $revs; do
>     git diff-tree --name-status $i -C $tree | grep $file |
>     sed "s/^/$i:/"
> done

Perhaps

        GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg |
        while read one
            git diff-tree --name-status -r $one -C $tree | grep $file |
            sed "s/^/$one:/"
        done

just in case the similar file you will discover is hidden in a
subdirectory?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Nov 23 09:45:05 2005

This archive was generated by hypermail 2.1.8 : 2005-11-23 09:45:11 EST