Skip to content

Commit 4fc2faf

Browse files
committed
Initial commit
0 parents  commit 4fc2faf

11 files changed

+527
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.o
2+
*.so

HISTORY.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# HISTORY
2+
3+
## 1.0.0
4+
5+
* First alpha release

LICENSE.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2014 Franck Verrot
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MODULES = git_fdw
2+
MODULE_big = git_fdw
3+
4+
SHLIB_LINK = -lgit2
5+
EXTENSION = git_fdw
6+
OBJS = git_fdw.o
7+
DATA = git_fdw--1.0.sql
8+
PGFILEDESC = "git_fdw - foreign data wrapper for git repositories"
9+
10+
PG_CONFIG = pg_config
11+
PGXS := $(shell $(PG_CONFIG) --pgxs)
12+
include $(PGXS)

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# PostgreSQL Git Foreign Data Wrapper
2+
3+
git\_fdw is a a Git Foreign Data Wrapper for PostgreSQL written in C.
4+
It is making use of ]`libgit2`](libgit2.github.com).
5+
6+
## INSTALLATION
7+
8+
### Prerequisites
9+
10+
* libgit2-dev
11+
12+
13+
### Setup
14+
15+
Building git\_fdw is as simple as
16+
17+
make
18+
19+
and installing it only requires oneself to
20+
21+
make install
22+
23+
24+
Now you can start setting up your environment to access git repositories:
25+
26+
λ psql
27+
psql (9.3.5)
28+
Type "help" for help.
29+
30+
franck=# CREATE EXTENSION git_fdw;
31+
CREATE EXTENSION
32+
33+
franck=# CREATE SERVER git_fdw_server FOREIGN DATA WRAPPER git_fdw;
34+
CREATE SERVER
35+
36+
franck=# CREATE FOREIGN TABLE rails_repository (message text, author text) SERVER git_fdw_server OPTIONS (path '/home/franck/rails/.git');
37+
CREATE FOREIGN TABLE
38+
39+
franck=# SELECT * FROM rails_repository LIMIT 10;
40+
message | author
41+
----------------------------------------------------------+----------------------------------------------------------
42+
Revert "Merge pull request #15312 from JuanitoFatas/acti | Matthew Draper <matthew@[REDACTED].net>
43+
Merge pull request #16908 from y-yagi/change_activejob_t | Abdelkader Boudih <terminale@[REDACTED].com>
44+
Change ActiveJob test directory to "test/jobs" +| yuuji.yaginuma <yuuji.yaginuma@[REDACTED].com>
45+
|
46+
Merge pull request #16669 from aantix/dangerous_attribut | Rafael Mendonça França <rafaelmfranca@[REDACTED].com>
47+
Changed the DangerousAttributeError exception message to | Jim Jones <[email protected]>
48+
Prepare maintenance policy for 4.2 release [ci skip] +| Rafael Mendonça França <rafaelmfranca@[REDACTED].com>
49+
|
50+
Se the test order of activejob tests +| Rafael Mendonça França <rafaelmfranca@[REDACTED].com>
51+
|
52+
Change gid calls to to_gid +| Rafael Mendonça França <rafaelmfranca@[REDACTED].com>
53+
|
54+
Merge pull request #16897 from kostia/message-varifier-r | Rafael Mendonça França <rafaelmfranca@[REDACTED].com>
55+
Changes "if secret.nil?" to unless secret in MessageVerf | Kostiantyn Kahanskyi <kostiantyn.kahanskyi@[REDACTED].co
56+
(10 rows)
57+
58+
59+
It is not possible to access multiple repositories through the same foreign
60+
table. We suggest the usage of views if this is something that needs to be
61+
achieved.
62+
63+
## CONFIGURATION
64+
65+
### Server
66+
67+
There are no options that can be passed to a git\_fdw server.
68+
69+
### Foreign Table
70+
71+
The possible options are:
72+
73+
* `path`: The path of the git repository;
74+
75+
76+
# Note on Patches/Pull Requests
77+
78+
* Fork the project.
79+
* Make your feature addition or bug fix.
80+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
81+
* Commit, do not mess with version or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
82+
* Send me a pull request. Bonus points for topic branches.
83+
84+
## LICENSE
85+
86+
Copyright (c) 2014 Franck Verrot. MIT LICENSE. See LICENSE.md for details.

execution_state.h

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
typedef struct GitFdwExecutionState
2+
{
3+
char *path;
4+
List *options;
5+
git_repository *repo;
6+
int passes;
7+
git_revwalk *walker;
8+
} GitFdwExecutionState;

git_fdw--1.0.sql

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\echo Use "CREATE EXTENSION git_fdw" to load this file. \quit
2+
3+
CREATE FUNCTION git_fdw_handler()
4+
RETURNS fdw_handler
5+
AS 'MODULE_PATHNAME'
6+
LANGUAGE C STRICT;
7+
8+
CREATE FUNCTION git_fdw_validator(text[], oid)
9+
RETURNS void
10+
AS 'MODULE_PATHNAME'
11+
LANGUAGE C STRICT;
12+
13+
CREATE FOREIGN DATA WRAPPER git_fdw
14+
HANDLER git_fdw_handler
15+
VALIDATOR git_fdw_validator;

0 commit comments

Comments
 (0)