Skip to content

Commit d5ac292

Browse files
committed
Requested changes
Signed-off-by: Antonio Jesus Navarro Perez <[email protected]>
1 parent 44a7b37 commit d5ac292

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 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>
22

3-
See a set of repositories as a standard database.
3+
Query git repositories with a MySQL interface.
44

55
## Installation
66

@@ -58,6 +58,7 @@ To make some common tasks easier for the user, there are some functions to inter
5858
| Name | Description |
5959
|:------------:|:---------------------------------------------------------------------------------------------------:|
6060
|commit_has_blob(commit_hash,blob_hash)bool| get if the specified commit contains the specified blob |
61+
|commit_has_tree(commit_hash,tree_hash)bool| get if the specified commit contains the specified tree |
6162
|history_idx(start_hash, target_hash)int| get the index of a commit in the history of another commit |
6263
|is_remote(reference_name)bool| check if the given reference name is from a remote one |
6364
|is_tag(reference_name)bool| check if the given reference name is a tag |
@@ -87,10 +88,9 @@ SELECT * FROM (
8788
SELECT COUNT(c.hash), c.hash
8889
FROM refs r
8990
INNER JOIN commits c
90-
ON history_idx(r.hash, c.hash) >= 0
91+
ON r.name = 'HEAD' AND history_idx(r.hash, c.hash) >= 0
9192
INNER JOIN blobs b
9293
ON commit_has_blob(c.hash, b.hash)
93-
WHERE r.name = 'HEAD'
9494
GROUP BY c.hash
9595
```
9696

@@ -105,8 +105,7 @@ SELECT COUNT(*) as num_commits, month, repo_id, committer_email
105105
committer_email
106106
FROM repositories r
107107
INNER JOIN refs ON refs.repository_id = r.id AND refs.name = 'HEAD'
108-
INNER JOIN commits c ON history_idx(refs.hash, c.hash) >= 0
109-
WHERE YEAR(committer_when) = 2015
108+
INNER JOIN commits c ON YEAR(committer_when) = 2015 AND history_idx(refs.hash, c.hash) >= 0
110109
) as t
111110
GROUP BY committer_email, month, repo_id
112111
```

0 commit comments

Comments
 (0)