Skip to content

Commit af125c3

Browse files
committed
Update readme parsing queries correctly
Signed-off-by: Antonio Jesus Navarro Perez <[email protected]>
1 parent 0f88996 commit af125c3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GitQuery <a href="https://travis-ci.org/src-d/gitquery"><img alt="Build Status" src="https://travis-ci.org/src-d/gitquery.svg?branch=master" /></a> <a href="https://codecov.io/gh/src-d/gitquery"><img alt="codecov" src="https://codecov.io/gh/src-d/gitquery/branch/master/graph/badge.svg" /></a> <a href="https://godoc.org/gopkg.in/src-d/gitquery.v0"><img alt="GoDoc" src="https://godoc.org/gopkg.in/src-d/gitquery.v0?status.svg" /></a>
1+
# GitBase <a href="https://travis-ci.org/src-d/gitquery"><img alt="Build Status" src="https://travis-ci.org/src-d/gitquery.svg?branch=master" /></a> <a href="https://codecov.io/gh/src-d/gitquery"><img alt="codecov" src="https://codecov.io/gh/src-d/gitquery/branch/master/graph/badge.svg" /></a> <a href="https://godoc.org/gopkg.in/src-d/gitquery.v0"><img alt="GoDoc" src="https://godoc.org/gopkg.in/src-d/gitquery.v0?status.svg" /></a>
22

33
Query git repositories with a MySQL interface.
44

@@ -75,39 +75,39 @@ SELECT * FROM refs WHERE name = 'HEAD'
7575

7676
```sql
7777
SELECT * FROM (
78-
SELECT COUNT(c.hash) AS num, c.hash
79-
FROM refs r
80-
INNER JOIN commits c
81-
ON history_idx(r.hash, c.hash) >= 0
82-
GROUP BY c.hash
83-
) t WHERE num > 1
78+
SELECT COUNT(c.hash) AS num, c.hash
79+
FROM refs r
80+
INNER JOIN commits c
81+
ON history_idx(r.hash, c.hash) >= 0
82+
GROUP BY c.hash
83+
) t WHERE num > 1
8484
```
8585

8686
### Get the number of blobs per HEAD commit
8787
```sql
8888
SELECT COUNT(c.hash), c.hash
89-
FROM refs r
90-
INNER JOIN commits c
91-
ON r.name = 'HEAD' AND history_idx(r.hash, c.hash) >= 0
92-
INNER JOIN blobs b
93-
ON commit_has_blob(c.hash, b.hash)
94-
GROUP BY c.hash
89+
FROM refs r
90+
INNER JOIN commits c
91+
ON r.name = 'HEAD' AND history_idx(r.hash, c.hash) >= 0
92+
INNER JOIN blobs b
93+
ON commit_has_blob(c.hash, b.hash)
94+
GROUP BY c.hash
9595
```
9696

9797
### Get commits per commiter, per month in 2015
9898

9999
```sql
100100
SELECT COUNT(*) as num_commits, month, repo_id, committer_email
101-
FROM (
102-
SELECT
103-
MONTH(committer_when) as month,
104-
r.id as repo_id,
105-
committer_email
106-
FROM repositories r
107-
INNER JOIN refs ON refs.repository_id = r.id AND refs.name = 'HEAD'
108-
INNER JOIN commits c ON YEAR(committer_when) = 2015 AND history_idx(refs.hash, c.hash) >= 0
109-
) as t
110-
GROUP BY committer_email, month, repo_id
101+
FROM (
102+
SELECT
103+
MONTH(committer_when) as month,
104+
r.id as repo_id,
105+
committer_email
106+
FROM repositories r
107+
INNER JOIN refs ON refs.repository_id = r.id AND refs.name = 'HEAD'
108+
INNER JOIN commits c ON YEAR(committer_when) = 2015 AND history_idx(refs.hash, c.hash) >= 0
109+
) as t
110+
GROUP BY committer_email, month, repo_id
111111
```
112112

113113
## License

0 commit comments

Comments
 (0)