From fdd1c228f4e93478331b57b355e518bd56d66e34 Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Tue, 15 Dec 2009 02:12:01 +0000 Subject: find-commit: - refactor git pull code so that it actually works - preselect only interesting log files with grep before full search (searches are now about 100x faster) git-svn-id: svn+ssh://svn.debian.org/svn/kernel-sec@1646 e094ebfe-e918-0410-adfb-c712417f3574 --- scripts/find-commit | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/find-commit b/scripts/find-commit index 551fd993..698e58a1 100755 --- a/scripts/find-commit +++ b/scripts/find-commit @@ -19,6 +19,7 @@ import os import sys +import urllib import tempfile if ( len( sys.argv ) < 2 ): @@ -56,9 +57,12 @@ os.chdir( gitdir ) fread = open( './.git/refs/heads/master' , 'r' ) local_hash = fread.readline().strip( '\n' ) fread.close() -pipe = os.popen( 'git ls-remote .' ) -remote_hash = pipe.readline().split()[0] -pipe.close() +fread = urllib.urlopen( 'http%s/packed-refs' % giturl[3::] , 'r' ) +split = [ '' , '' ] +while ( split[1] != 'refs/heads/master' ): + split = fread.readline().strip( ' \n' ).split() +remote_hash = split[0] +fread.close() if ( local_hash != remote_hash ): if ( os.system( 'git pull' ) != 0 ): sys.exit( 1 ) @@ -100,7 +104,10 @@ for tag in tags: # search thru the generated files for text of interest foundtext = False -for fname in fnames: +pipe = os.popen( 'grep %s %s*' % ( sys.argv[1] , rootname ) ) +pline = pipe.readline() +while pline: + fname = pline.split()[0].rstrip( ':' ) fread = open( fname , 'r' ) line = fread.readline() while line: @@ -116,3 +123,5 @@ for fname in fnames: foundtext = True line = fread.readline() fread.close() + pline = pipe.readline() +pipe.close() -- cgit v1.2.3