git - Efficient retrieval of releases that contain a commit -


in command line, if type

git tag --contains {commit} 

to obtain list of releases contain given commit, takes around 11 20 seconds each commit. since target code base there exists more 300,000 commits, take lot retrieve information commits.

however, gitk apparently manages job retrieving data. searched, uses cache purpose.

i have 2 questions:

  1. how can interpret cache format?
  2. is there way obtain dump git command line tool generate same information?

you can directly git rev-list.

latest.awk:

begin { thiscommit=""; } $1 == "commit" {     if ( thiscommit != "" )         print thiscommit, tags[thiscommit]     thiscommit=$2     line[$2]=nr     latest = 0;     ( = 3 ; <= nf ; ++i ) if ( line[$i] > latest ) {         latest = line[$i];         tags[$2] = tags[$i];     }     next; } $1 != "commit"  { tags[thiscommit] = $0; } end { if ( thiscommit != "" ) print thiscommit, tags[thiscommit]; } 

a sample command:

git rev-list --date-order --children --format=%d --all | awk -f latest.awk 

you can use --topo-order, , you'll have weed out unwanted refs in $1!="commit" logic.

depending on kind of transitivity want , how explicit listing has be, accumulating tags might need dictionary. here's 1 gets explicit listing of refs commits:

all.awk:

begin {     thiscommit=""; } $1 == "commit" {     if ( thiscommit != "" )         print thiscommit, tags[thiscommit]     thiscommit=$2     line[$2]=nr     split("",seen);     ( = 3 ; <= nf ; ++i ) {         nnew=split(tags[$i],new);         ( n = 1 ; n <= nnew ; ++n ) {             if ( !seen[new[n]] ) {                 tags[$2]= tags[$2]" "new[n]                 seen[new[n]] = 1             }         }     }     next; } $1 != "commit"  {     nnew=split($0,new,", ");     new[1]=substr(new[1],3);     new[nnew]=substr(new[nnew],1,length(new[nnew])-1);     ( n = 1; n <= nnew ; ++n )         tags[thiscommit] = tags[thiscommit]" "new[n]  } end { if ( thiscommit != "" ) print thiscommit, tags[thiscommit]; } 

all.awk took few minutes 322k linux kernel repo commits, thousand second or (lots of duplicate strings , redundant processing) you'd want rewrite in c++ if you're after complete cross-product ... don't think gitk shows that, nearest neighbors, right?


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -