@@ -38,9 +38,9 @@ func TestIntegration(t *testing.T) {
3838	}{
3939		{
4040			`SELECT COUNT(c.commit_hash), c.commit_hash 
41- 			FROM refs  r 
41+ 			FROM ref_commits  r 
4242			INNER JOIN commits c 
43- 				ON r.ref_name = 'HEAD' AND history_idx( r.commit_hash,  c.commit_hash) >= 0  
43+ 				ON r.ref_name = 'HEAD' AND r.commit_hash =  c.commit_hash 
4444			INNER JOIN blobs b 
4545				ON commit_has_blob(c.commit_hash, b.blob_hash) 
4646			GROUP BY c.commit_hash` ,
@@ -66,10 +66,10 @@ func TestIntegration(t *testing.T) {
6666		},
6767		{
6868			`SELECT c.commit_hash 
69- 			FROM refs   
69+ 			FROM ref_commits r   
7070			INNER JOIN commits c  
71- 				ON refs .ref_name = 'HEAD'  
72- 				AND history_idx(refs .commit_hash,  c.commit_hash) >= 0 ` ,
71+ 				ON r .ref_name = 'HEAD'  
72+ 				AND r .commit_hash =  c.commit_hash` ,
7373			[]sql.Row {
7474				{"6ecf0ef2c2dffb796033e5a02219af86ec6584e5" },
7575				{"918c48b83bd081e863dbe1b80f8998f058cd8294" },
@@ -86,10 +86,10 @@ func TestIntegration(t *testing.T) {
8686			FROM ( 
8787				SELECT YEAR(c.commit_author_when) AS first_commit_year 
8888				FROM repositories r 
89- 				INNER JOIN refs   
90- 					ON r.repository_id = refs .repository_id 
89+ 				INNER JOIN ref_commits rc  
90+ 					ON r.repository_id = rc .repository_id 
9191				INNER JOIN commits c  
92- 					ON history_idx(refs .commit_hash,  c.commit_hash) >= 0  
92+ 					ON rc .commit_hash =  c.commit_hash 
9393				ORDER BY c.commit_author_when  
9494				LIMIT 1 
9595			) repo_years 
@@ -104,9 +104,9 @@ func TestIntegration(t *testing.T) {
104104					r.repository_id as repo_id, 
105105					committer_email 
106106				FROM repositories r 
107- 				INNER JOIN refs  ON refs .repository_id = r.repository_id  
108- 					AND refs .ref_name = 'refs/heads/master' 
109- 				INNER JOIN commits c ON history_idx(refs .commit_hash,  c.commit_hash) >= 0  
107+ 				INNER JOIN ref_commits rc  ON rc .repository_id = r.repository_id  
108+ 					AND rc .ref_name = 'refs/heads/master' 
109+ 				INNER JOIN commits c ON rc .commit_hash =  c.commit_hash 
110110				WHERE YEAR(committer_when) = 2015 
111111			) as t 
112112			GROUP BY committer_email, month, repo_id` ,
@@ -119,9 +119,9 @@ func TestIntegration(t *testing.T) {
119119		{
120120			`SELECT * FROM ( 
121121				SELECT COUNT(c.commit_hash) AS num, c.commit_hash 
122- 				FROM refs  r 
122+ 				FROM ref_commits  r 
123123				INNER JOIN commits c 
124- 					ON history_idx( r.commit_hash,  c.commit_hash) >= 0  
124+ 					ON r.commit_hash =  c.commit_hash 
125125				GROUP BY c.commit_hash 
126126			) t WHERE num > 1` ,
127127			[]sql.Row {
@@ -224,7 +224,7 @@ func TestSquashCorrectness(t *testing.T) {
224224		`SELECT * FROM repositories r INNER JOIN remotes ON r.repository_id = remotes.repository_id` ,
225225		`SELECT * FROM refs r INNER JOIN remotes re ON r.repository_id = re.repository_id` ,
226226		`SELECT * FROM refs r INNER JOIN commits c ON r.commit_hash = c.commit_hash` ,
227- 		`SELECT * FROM refs  r INNER JOIN commits c ON history_idx( r.commit_hash,  c.commit_hash) >= 0 ` ,
227+ 		`SELECT * FROM ref_commits  r INNER JOIN commits c ON r.commit_hash =  c.commit_hash` ,
228228		`SELECT * FROM refs r INNER JOIN tree_entries te ON commit_has_tree(r.commit_hash, te.tree_hash)` ,
229229		`SELECT * FROM refs r INNER JOIN blobs b ON commit_has_blob(r.commit_hash, b.blob_hash)` ,
230230		`SELECT * FROM commits c INNER JOIN tree_entries te ON commit_has_tree(c.commit_hash, te.tree_hash)` ,
0 commit comments