Skip to content

Commit 6b1a4a5

Browse files
authored
Merge branch 'master' into fix/uast-panic
2 parents cc71650 + fbdd7a1 commit 6b1a4a5

25 files changed

+487
-17
lines changed

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# source{d} Contributing Guidelines
2+
3+
source{d} projects accept contributions via GitHub pull requests.
4+
This document outlines some of the
5+
conventions on development workflow, commit message formatting, contact points,
6+
and other resources to make it easier to get your contribution accepted.
7+
8+
## Certificate of Origin
9+
10+
By contributing to this project you agree to the [Developer Certificate of
11+
Origin (DCO)](DCO). This document was created by the Linux Kernel community and is a
12+
simple statement that you, as a contributor, have the legal right to make the
13+
contribution.
14+
15+
In order to show your agreement with the DCO you should include at the end of commit message,
16+
the following line: `Signed-off-by: John Doe <[email protected]>`, using your real name.
17+
18+
This can be done easily using the [`-s`](https://github.com/git/git/blob/b2c150d3aa82f6583b9aadfecc5f8fa1c74aca09/Documentation/git-commit.txt#L154-L161) flag on the `git commit`.
19+
20+
## Support Channels
21+
22+
The official support channels, for both users and contributors, are:
23+
24+
- GitHub issues: each repository has its own list of issues.
25+
- Slack: join the [source{d} Slack](https://join.slack.com/t/sourced-community/shared_invite/enQtMjc4Njk5MzEyNzM2LTFjNzY4NjEwZGEwMzRiNTM4MzRlMzQ4MmIzZjkwZmZlM2NjODUxZmJjNDI1OTcxNDAyMmZlNmFjODZlNTg0YWM) community.
26+
27+
*Before opening a new issue or submitting a new pull request, it's helpful to
28+
search the project - it's likely that another user has already reported the
29+
issue you're facing, or it's a known issue that we're already aware of.
30+
31+
## How to Contribute
32+
33+
Pull Requests (PRs) are the main and exclusive way to contribute code to source{d} projects.
34+
In order for a PR to be accepted it needs to pass a list of requirements:
35+
36+
- The contribution must be correctly explained with natural language and providing a minimum working example that reproduces it.
37+
- All PRs must be written idiomaticly:
38+
- for Go: formatted according to [gofmt](https://golang.org/cmd/gofmt/), and without any warnings from [go lint](https://github.com/golang/lint) nor [go vet](https://golang.org/cmd/vet/)
39+
- for other languages, similar constraints apply.
40+
- They should in general include tests, and those shall pass.
41+
- If the PR is a bug fix, it has to include a new unit test that fails before the patch is merged.
42+
- If the PR is a new feature, it has to come with a suite of unit tests, that tests the new functionality.
43+
- In any case, all the PRs have to pass the personal evaluation of at least one of the [maintainers](MAINTAINERS).
44+
45+
### Format of the commit message
46+
47+
Every commit message should describe what was changed, under which context and, if applicable, the GitHub issue it relates to:
48+
49+
```
50+
plumbing: packp, Skip argument validations for unknown capabilities. Fixes #623
51+
```
52+
53+
The format can be described more formally as follows:
54+
55+
```
56+
<package>: <subpackage>, <what changed>. [Fixes #<issue-number>]
57+
```

Gopkg.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[constraint]]
22
name = "gopkg.in/src-d/go-mysql-server.v0"
3-
revision = "7030a31bb89087929ad0f5401a5e8ae0e7e18aa2"
3+
revision = "44e416bff2e89a515172814e3f688afe5d875deb"
44

55
[[constraint]]
66
name = "github.com/jessevdk/go-flags"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ You can see some [query examples](/docs/using-gitbase/examples.md) in [gitbase d
2020

2121
## Motivation and scope
2222

23-
gitbase was born to ease the analysis of git repositories and its source code.
23+
gitbase was born to ease the analysis of git repositories and their source code.
2424

2525
Also, making it MySQL compatible, we provide the maximum compatibility between languages and existing tools.
2626

27-
As a single binary allows use it as a standalone service. The service is able to process local repositories or integrate with existing tools and frameworks (e.g. spark) to make source code analysis on the large scale.
27+
It comes as a single self-contained binary and it can be used as a standalone service. The service is able to process local repositories or integrate with existing tools and frameworks (e.g. spark) to make source code analysis on a large scale.
2828

2929
## Further reading
3030

docs/using-gitbase/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ NATURAL JOIN
2727
ref_commits
2828
WHERE
2929
ref_commits.ref_name = 'HEAD'
30-
AND ref_commits.index = 0;
30+
AND ref_commits.history_index = 0;
3131
```
3232

3333
## Commits that appear in more than one reference
@@ -86,7 +86,7 @@ NATURAL JOIN
8686
ref_commits
8787
WHERE
8888
ref_commits.ref_name = 'HEAD'
89-
AND ref_commits.index BETWEEN 0 AND 5
89+
AND ref_commits.history_index BETWEEN 0 AND 5
9090
AND is_binary(blob_content) = false
9191
AND files.file_path NOT REGEXP '^vendor.*'
9292
AND (

docs/using-gitbase/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ To make some common tasks easier for the user, there are some functions to inter
1414

1515
## Standard functions
1616

17-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/9c3b77f244b0909fed15a669be2cdeb355462a7d#custom-functions).
17+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/44e416bff2e89a515172814e3f688afe5d875deb#custom-functions).

docs/using-gitbase/indexes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Note that you can create an index either **on one or more columns** or **on a si
1010

1111
You can find some more examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section.
1212

13-
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/9c3b77f244b0909fed15a669be2cdeb355462a7d#indexes) documentation for more details
13+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/44e416bff2e89a515172814e3f688afe5d875deb#indexes) documentation for more details

docs/using-gitbase/schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ This table represents the relation between commits and [files](#files). Using th
173173
| repository_id | TEXT |
174174
| commit_hash | TEXT |
175175
| ref_name | TEXT |
176-
| index | INT64 |
176+
| history_index | INT64 |
177177
+---------------+-------+
178178
```
179179

180-
This table allow us to get the commit history from a specific reference name. `index` column represent the position of the commit from a specific reference.
180+
This table allow us to get the commit history from a specific reference name. `history_index` column represents the position of the commit from a specific reference.
181181

182182
This table it's like the [log](https://git-scm.com/docs/git-log) from a specific reference.
183183

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Supported syntax
22

3-
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/9c3b77f244b0909fed15a669be2cdeb355462a7d/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).
3+
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/44e416bff2e89a515172814e3f688afe5d875deb/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

integration_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,25 @@ func TestSquashCorrectness(t *testing.T) {
351351
ON r.commit_hash = c.commit_hash
352352
AND r.ref_name = c.ref_name
353353
AND c.repository_id = r.repository_id`,
354+
355+
`SELECT COUNT(r.*) as repos FROM repositories r`,
356+
357+
`SELECT repository_id, num_files FROM (
358+
SELECT COUNT(f.*) num_files, f.repository_id
359+
FROM ref_commits r
360+
INNER JOIN commit_files cf
361+
ON r.commit_hash = cf.commit_hash
362+
AND r.repository_id = cf.repository_id
363+
INNER JOIN files f
364+
ON cf.repository_id = f.repository_id
365+
AND cf.blob_hash = f.blob_hash
366+
AND cf.tree_hash = f.tree_hash
367+
AND cf.file_path = f.file_path
368+
WHERE r.ref_name = 'HEAD'
369+
GROUP BY f.repository_id
370+
) t
371+
ORDER BY num_files DESC
372+
LIMIT 10`,
354373
}
355374

356375
for _, q := range queries {

0 commit comments

Comments
 (0)