@@ -30,6 +30,12 @@ Available commands:
30
30
version Show the version information.
31
31
```
32
32
33
+ You can start a server using some repositores from ` /path/to/repositories ` with this command:
34
+
35
+ ```
36
+ $ gitbase server -v -g /path/to/repositories
37
+ ```
38
+
33
39
A MySQL client is needed to connect to the server. For example:
34
40
35
41
``` bash
@@ -45,33 +51,46 @@ SELECT hash, author_email, author_name FROM commits LIMIT 2;
45
51
2 rows in set (0.01 sec)
46
52
```
47
53
54
+ ### Environment variables
55
+
56
+ | Name | Description |
57
+ | :-----------------------------| :--------------------------------------------------|
58
+ | ` BBLFSH_ENDPOINT ` | bblfshd endpoint, default "127.0.0.1:9432" |
59
+ | ` GITBASE_BLOBS_MAX_SIZE ` | maximum blob size to return in MiB, default 5 MiB |
60
+ | ` GITBASE_BLOBS_ALLOW_BINARY ` | enable retrieval of binary blobs, default ` false ` |
61
+ | ` UNSTABLE_SQUASH_ENABLE ` | ** UNSTABLE** check * Unstable features* |
62
+
48
63
## Tables
49
64
50
65
You can execute the ` SHOW TABLES ` statement to get a list of the available tables.
51
66
To get all the columns and types of a specific table, you can write ` DESCRIBE TABLE [tablename] ` .
52
67
53
68
gitbase exposes the following tables:
54
69
55
- | Name | Columns |
56
- | :------------:| :---------------------------------------------------------------------------------------------------:|
57
- | repositories | id |
58
- | remotes | repository_id, name, push_url,fetch_url,push_refspec,fetch_refspec |
59
- | commits | hash, author_name, author_email, author_when, comitter_name, comitter_email, comitter_when, message, tree_hash |
60
- | blobs | hash, size, content |
61
- | refs | repository_id, name, hash |
62
- | tree_entries | tree_hash, entry_hash, mode, name |
70
+ | Name | Columns |
71
+ | :-------------| :------------------------------------------------------------------------------------------------------------------|
72
+ | repositories | id |
73
+ | remotes | repository_id, name, push_url, fetch_url, push_refspec, fetch_refspec |
74
+ | commits | hash, author_name, author_email, author_when, committer_name, committer_email, committer_when, message, tree_hash |
75
+ | blobs | hash, size, content |
76
+ | refs | repository_id, name, hash |
77
+ | tree_entries | tree_hash, entry_hash, mode, name |
78
+ | references | repository_id, name, hash |
63
79
64
80
## Functions
65
81
66
82
To make some common tasks easier for the user, there are some functions to interact with the previous mentioned tables:
67
83
68
84
| Name | Description |
69
- | :------------: | :---------------------------------------------------------------------------------------------------: |
85
+ | :------------- | :---------------------------------------------------------------------------------------------------- |
70
86
| commit_has_blob(commit_hash,blob_hash)bool| get if the specified commit contains the specified blob |
71
87
| commit_has_tree(commit_hash,tree_hash)bool| get if the specified commit contains the specified tree |
72
88
| history_idx(start_hash, target_hash)int| get the index of a commit in the history of another commit |
73
89
| is_remote(reference_name)bool| check if the given reference name is from a remote one |
74
90
| is_tag(reference_name)bool| check if the given reference name is a tag |
91
+ | language(path, [ blob] )text| gets the language of a file given its path and the optional content of the file |
92
+ | uast(blob, [ lang, [ xpath]] )json_blob| returns an array of UAST nodes as blobs |
93
+ | uast_xpath(json_blob, xpath)| performs an XPath query over the given UAST nodes |
75
94
76
95
## Unstable features
77
96
@@ -82,7 +101,6 @@ To make some common tasks easier for the user, there are some functions to inter
82
101
### Get all the HEAD references from all the repositories
83
102
``` sql
84
103
SELECT * FROM refs WHERE name = ' HEAD'
85
-
86
104
```
87
105
88
106
### Commits that appears in more than one reference
0 commit comments