{"thread":{"id":"2653","subject":"$Revision$ keyword replacement?","startedAt":"2005-11-22T17:36:41Z","lastAt":"2005-11-22T23:40:16Z","messageCount":4,"participants":["Santi Béjar","Junio C Hamano","Santi Bejar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12549","messageId":"871x18h9ee.fsf@ifae.es","threadId":"2653","inReplyTo":null,"subject":"$Revision$ keyword replacement?","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2005-11-22T17:36:41Z","receivedAt":"2005-11-22T17:36:41Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Hello:\n\n        I'm looking for a $Revision$ replacement. I know, in git all that\n        matters are the contents. So the equivalent in git could be:\n\n        How similar this file is to the file $path in these commit(s)?\n\n        What I use now is an ugly shell script (as you might known\n        I'm not a C programer), see the attatchment.\n\n        So I get:\n\n311bf741d16ee5d0166639a4fafd9194e504aad3:R094   introduccio.tex sim.tex\nb764ee049289f5157238596cccc7a4e15f23896c:R094   introduccio.tex sim.tex\nf293e1ab1dfb7ff60cb269ed5b18f9222099a752:R098   introduccio.tex sim.tex\nf14c4b2d6799354d376e2026a5b7a85ccce48284:R098   introduccio.tex sim.tex\n183af55606310218ca0e9a735dad0827acea7910:R098   introduccio.tex sim.tex\n73fd2531cce3db0ca804577fb29f87f413fc4563:R096   introduccio.tex sim.tex\n\n        Do you know any other (or better :) way to do it?\n\n        Thanks\n\n        Santi\n\n\n\n#!/bin/sh\n##\n## find-sim finds the similarity of one file with the files in the\n##           selected commits\n##\n## The arguments are:\n##      $1     - file to compare\n##      $n n>2 - arguments for git-rev-list to select the commits\n##\n. git-sh-setup || die \"Not a git archive.\"\n\n[ ! -e $1 ] && exit 1\nfile=$1\nshift\n\ncase $GIT_DIR in\n    /*)\n\tGIT_DIR_ORIG=$GIT_DIR;;\n    *)\n\tGIT_DIR_ORIG=$PWD/$GIT_DIR\nesac\n\ntmp=`mktemp -t -d git-find-sim.XXXXXXX`\nGIT_DIR_TEMP=$tmp\nmkdir -p $GIT_DIR_TEMP/objects/info\n[ -e $GIT_DIR_ORIG/objects/info/alternates ] &&\ncp $GIT_DIR_ORIG/objects/info/alternates $GIT_DIR_TEMP/objects/info/alternates\necho $GIT_DIR_ORIG/objects >> $GIT_DIR_TEMP/objects/info/alternates\nexport GIT_DIR=$GIT_DIR_TEMP\n\ntrap \"rm -rf $tmp\" 0 1 2 3 15\n\ngit update-index --add $file || exit 1\ntree=`git-write-tree`\n\nrev_arg=`GIT_DIR=$GIT_DIR_ORIG git-rev-parse --default HEAD --revs-only \"$@\"`\nrevs=`GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg`\nfor i in $revs; do\n    git diff-tree --name-status $i -C $tree | grep $file |\n    sed \"s/^/$i:/\"\ndone\n"},{"id":"12568","messageId":"7vy83gb8zk.fsf@assigned-by-dhcp.cox.net","threadId":"2653","inReplyTo":"871x18h9ee.fsf@ifae.es","subject":"finding similar blobs (was: Re: $Revision$ keyword replacement?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-22T22:42:07Z","receivedAt":"2005-11-22T22:42:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n>         How similar this file is to the file $path in these commit(s)?\n\nVery cute.\n\n> tmp=`mktemp -t -d git-find-sim.XXXXXXX`\n> ...\n> git update-index --add $file || exit 1\n> tree=`git-write-tree`\n\nAre you going through all this trouble just to avoid a blob and\na tree object left dangling after you are done?  Or is there\nsomething else going on?\n\n> rev_arg=`GIT_DIR=$GIT_DIR_ORIG git-rev-parse --default HEAD --revs-only \"$@\"`\n> revs=`GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg`\n> for i in $revs; do\n>     git diff-tree --name-status $i -C $tree | grep $file |\n>     sed \"s/^/$i:/\"\n> done\n\nPerhaps\n\n        GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg |\n        while read one\n            git diff-tree --name-status -r $one -C $tree | grep $file |\n            sed \"s/^/$one:/\"\n        done\n\njust in case the similar file you will discover is hidden in a\nsubdirectory?\n"},{"id":"12573","messageId":"8aa486160511221510v667dbfd5y@mail.gmail.com","threadId":"2653","inReplyTo":"7vy83gb8zk.fsf@assigned-by-dhcp.cox.net","subject":"Re: finding similar blobs (was: Re: $Revision$ keyword replacement?","fromName":"Santi Bejar","fromEmail":"sbejar@gmail.com","sentAt":"2005-11-22T23:10:27Z","receivedAt":"2005-11-22T23:10:27Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2005/11/22, Junio C Hamano <junkio@cox.net>:\n> Santi Béjar <sbejar@gmail.com> writes:\n>\n\n>\n> > tmp=`mktemp -t -d git-find-sim.XXXXXXX`\n> > ...\n> > git update-index --add $file || exit 1\n> > tree=`git-write-tree`\n>\n> Are you going through all this trouble just to avoid a blob and\n> a tree object left dangling after you are done?  Or is there\n> something else going on?\n\nNo, there is nothing else. These are \"easy\" avoided, so why have these\ndangling {blob,tree,...}s?\n\n>\n> > rev_arg=`GIT_DIR=$GIT_DIR_ORIG git-rev-parse --default HEAD --revs-only \"$@\"`\n> > revs=`GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg`\n> > for i in $revs; do\n> >     git diff-tree --name-status $i -C $tree | grep $file |\n> >     sed \"s/^/$i:/\"\n> > done\n>\n> Perhaps\n>\n>         GIT_DIR=$GIT_DIR_ORIG git-rev-list $rev_arg |\n>         while read one\n>             git diff-tree --name-status -r $one -C $tree | grep $file |\n>             sed \"s/^/$one:/\"\n>         done\n>\n> just in case the similar file you will discover is hidden in a\n> subdirectory?\n\nOops :)\n\nSanti\n"},{"id":"12577","messageId":"7vmzjwb6an.fsf@assigned-by-dhcp.cox.net","threadId":"2653","inReplyTo":"8aa486160511221510v667dbfd5y@mail.gmail.com","subject":"Re: finding similar blobs (was: Re: $Revision$ keyword replacement?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-22T23:40:16Z","receivedAt":"2005-11-22T23:40:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Bejar <sbejar@gmail.com> writes:\n\n> No, there is nothing else. These are \"easy\" avoided, so why have these\n> dangling {blob,tree,...}s?\n\nOnly because I am lazy ;-).\n"}]}