From: "Santi Béjar" <sbejar@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: $Revision$ keyword replacement?
Date: Tue, 22 Nov 2005 18:36:41 +0100 [thread overview]
Message-ID: <871x18h9ee.fsf@ifae.es> (raw)
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
Hello:
I'm looking for a $Revision$ replacement. I know, in git all that
matters are the contents. So the equivalent in git could be:
How similar this file is to the file $path in these commit(s)?
What I use now is an ugly shell script (as you might known
I'm not a C programer), see the attatchment.
So I get:
311bf741d16ee5d0166639a4fafd9194e504aad3:R094 introduccio.tex sim.tex
b764ee049289f5157238596cccc7a4e15f23896c:R094 introduccio.tex sim.tex
f293e1ab1dfb7ff60cb269ed5b18f9222099a752:R098 introduccio.tex sim.tex
f14c4b2d6799354d376e2026a5b7a85ccce48284:R098 introduccio.tex sim.tex
183af55606310218ca0e9a735dad0827acea7910:R098 introduccio.tex sim.tex
73fd2531cce3db0ca804577fb29f87f413fc4563:R096 introduccio.tex sim.tex
Do you know any other (or better :) way to do it?
Thanks
Santi
[-- Attachment #2: git-find-sim --]
[-- Type: text/plain, Size: 1052 bytes --]
#!/bin/sh
##
## find-sim finds the similarity of one file with the files in the
## selected commits
##
## The arguments are:
## $1 - file to compare
## $n n>2 - arguments for git-rev-list to select the commits
##
. git-sh-setup || die "Not a git archive."
[ ! -e $1 ] && exit 1
file=$1
shift
case $GIT_DIR in
/*)
GIT_DIR_ORIG=$GIT_DIR;;
*)
GIT_DIR_ORIG=$PWD/$GIT_DIR
esac
tmp=`mktemp -t -d git-find-sim.XXXXXXX`
GIT_DIR_TEMP=$tmp
mkdir -p $GIT_DIR_TEMP/objects/info
[ -e $GIT_DIR_ORIG/objects/info/alternates ] &&
cp $GIT_DIR_ORIG/objects/info/alternates $GIT_DIR_TEMP/objects/info/alternates
echo $GIT_DIR_ORIG/objects >> $GIT_DIR_TEMP/objects/info/alternates
export GIT_DIR=$GIT_DIR_TEMP
trap "rm -rf $tmp" 0 1 2 3 15
git update-index --add $file || exit 1
tree=`git-write-tree`
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
next reply other threads:[~2005-11-22 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-22 17:36 Santi Béjar [this message]
2005-11-22 22:42 ` finding similar blobs (was: Re: $Revision$ keyword replacement? Junio C Hamano
2005-11-22 23:10 ` Santi Bejar
2005-11-22 23:40 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871x18h9ee.fsf@ifae.es \
--to=sbejar@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.