Re: Digging through old vendor code

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

 



On Sun, Jan 13, 2008 at 11:28:06AM -0500, linux@xxxxxxxxxxx wrote:

> Maybe a real git wizard will show me how to insert the index entries
> directly without ever doing anything as pedestrian as extracting, hashing,
> and then deleting the files, but it's still not that bad.

git-read-tree?  Unfortunately it has no option to insert only a subset
of the tree. But you can make do with git-ls-tree piped to
git-update-index.

Using the script below, Jon's sample file seems to be

  v2.6.15-rc6-81-g0b57ee9:drivers/serial/amba-pl010.c

and it runs in about 8 seconds on v2.6.13..v2.6.15. I think it might be
more intuitive to just diff a temporary index against each tree, but I
don't think there's a way to say "find copies harder, but use only this
subset of files as the source" which makes it less efficient.

Jon, you might try playing around with different ranges. I get a
different answer for v2.6.13..v2.6.16.

-- >8 --
SRC=drivers/serial

echo >&2 Cleaning up after old runs...
rm -f tmpindex
git branch -D tmpbranch

echo >&2 Creating giant source commit...
for i in `git rev-list v2.6.13..v2.6.15 -- $SRC`; do
  git ls-tree -r $i -- $SRC |
    # note the whitespace is a literal tab
    sed "s,	,	$i/," |
    GIT_INDEX_FILE=tmpindex git update-index --index-info
done
tree=`GIT_INDEX_FILE=tmpindex git write-tree`
commit=`echo source | git commit-tree $tree`
git update-ref refs/heads/tmpbranch $commit

echo >&2 Creating updated index...
GIT_INDEX_FILE=tmpindex git add candidate.c
echo >&2 Diffing...
GIT_INDEX_FILE=tmpindex git diff-index --cached -l0 -M1% -C1% --find-copies-harder tmpbranch

# now you should manually git-describe the winner
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux