Implement the following plan:
Store git objects and refs in Postgres tables. Two implementations: pure SQL (PL/pgSQL functions, works on managed Postgres) and a C extension (native types, faster parsing). A libgit2-based bridge program registers Postgres as the storage backend so standard git push/fetch/clone work against the database.
gitgres/
Makefile # top-level, delegates to sub-makes
sql/
schema.sql # tables, indexes
functions/
object_hash.sql
object_read_write.sql
tree_parse.sql
commit_parse.sql
ref_manage.sql
views/
queryable.sql # materialized views
ext/ # Postgres C extension
Makefile # PGXS
gitgres.c # PG_MODULE_MAGIC, init
git_oid_type.c # 20-byte OID type with operators
sha1_hash.c # C SHA1 via OpenSSL
tree_parse.c # C tree entry parser
gitgres.control
sql/gitgres--0.1.sql # CREATE TYPE, CREATE FUNCTION
backend/ # libgit2 pluggable backend
Makefile
main.c # CLI entry point (serves repos)
odb_postgres.c # git_odb_backend implementation
odb_postgres.h
refdb_postgres.c # git_refdb_backend implementation
refdb_postgres.h
writepack_postgres.c # packfile receive handling
import/
gitgres-import.sh # shell script: git plumbing + psql
test/
test_helper.rb
schema_test.rb
object_hash_test.rb
object_store_test.rb
tree_parse_test.rb
commit_parse_test.rb
ref_test.rb
roundtrip_test.rb # push then clone, diff working trees
Depends on pgcrypto (available on all managed Postgres). OIDs stored as bytea (20 bytes raw).
git_object_hash(type, content) -- SHA1 of <type> <size>\0<content> using pgcrypto digest()git_object_write(repo_id, type, content) -- compute hash, INSERT ON CONFLICT DO NOTHING, return oidgit_object_read(repo_id, oid) -- return (type, size, content)git_object_read_prefix(repo_id, prefix, prefix_len) -- abbreviated OID lookupgit_tree_entries(content) -- parse binary tree into (mode, name, entry_oid) rowsgit_commit_parse(content) -- parse commit into tree_oid, parent_oids[], author fields, committer fields, messagegit_ref_update(repo_id, name, new_oid, old_oid, force) -- compare-and-swap with SELECT FOR UPDATEgit_ls_tree_r(repo_id, tree_oid, prefix) -- recursive tree walk returning (mode, path, oid, type)This is the bridge. Implement git_odb_backend and git_refdb_backend structs that store/retrieve from Postgres via libpq. libgit2 handles all protocol work (pack negotiation, delta resolution, ref advertisement).
odb_postgres.c)Implements these callbacks from git_odb_backend:
read(data, len, type, backend, oid) -- SELECT type, size, content FROM objects WHERE repo_id=$1 AND oid=$2read_header(len, type, backend, oid) -- SELECT type, size FROM objects WHERE ...read_prefix(full_oid, data, len, type, backend, short_oid, prefix_len) -- prefix match on oid columnwrite(backend, oid, data, len, type) -- INSERT INTO objects ... ON CONFLICT DO NOTHINGexists(backend, oid) -- SELECT 1 FROM objects WHERE ...exists_prefix(full_oid, backend, short_oid, prefix_len) -- prefix existence checkforeach(backend, cb, payload) -- SELECT oid FROM objects WHERE repo_id=$1, call cb for eachwritepack(writepack_out, backend, odb, progress_cb, payload) -- return a git_odb_writepack that accumulates pack bytes, then on commit delegates to libgit2's indexer to extract objects and calls write for eachfree(backend) -- close PG connectionThe backend struct holds a PGconn* and the repo_id.
refdb_postgres.c)Implements these callbacks from git_refdb_backend:
exists(exists_out, backend, ref_name) -- SELECT 1 FROM refs WHERE ...lookup(ref_out, backend, ref_name) -- SELECT oid, symbolic FROM refs WHERE ..., construct git_referenceiterator(iter_out, backend, glob) -- SELECT name, oid, symbolic FROM refs WHERE name LIKE ..., return custom iteratorwrite(backend, ref, force, who, message, old_id, old_target) -- CAS update using a transaction with SELECT FOR UPDATErename(ref_out, backend, old_name, new_name, force, who, message) -- UPDATE refs SET name=$1del(backend, ref_name, old_id, old_target) -- DELETE with CAS checkhas_log / ensure_log / reflog_read / reflog_write / reflog_rename / reflog_delete -- operate on the reflog tablelock / unlock -- use Postgres advisory locks (pg_advisory_xact_lock)free(backend) -- close connectionmain.c)A program that serves one or more repos. For testing, it can run as a one-shot helper that git invokes. Longer term it could serve HTTP smart protocol or the git:// protocol.
Initial approach: implement a git-remote-gitgres helper. When you do git clone gitgres::postgres://localhost/mydb/myrepo, git invokes git-remote-gitgres postgres://localhost/mydb/myrepo. The helper:
libgit2 has git_transport_register for custom transports, or we can use the simpler git_remote_callbacks approach.
ext/)The Postgres extension, separate from the libgit2 backend. Adds performance for SQL queries.
git_oid type: 20-byte fixed binary, hex I/O, btree + hash operator classes. Replaces bytea columns with a proper type so you can write WHERE oid = 'abc123...'.git_object_hash_c(type, content) RETURNS git_oid: C SHA1 via OpenSSL, ~10x faster than pgcryptogit_tree_entries_c(content) RETURNS SETOF (mode, name, oid): C pointer arithmetic instead of PL/pgSQL byte walkingBuilt with PGXS, links against OpenSSL.
import/gitgres-import.sh)Shell script that imports an existing git repo into the database using git plumbing commands and psql.
Usage: gitgres-import <repo-path> <conninfo> <repo-name>
git -C <repo> rev-list --objects --all to get all object OIDsgit -C <repo> cat-file --batch to get type + contentgit -C <repo> show-ref to get all refs, INSERT into refs tableSchema + object hash + read/write functions -- the foundation. Verify that git_object_hash(3, 'hello') matches git hash-object --stdin.
Tree + commit parsing functions -- test against real objects from a git repo using git cat-file.
Import script -- import a small test repo (~50 commits). Verify object count matches git rev-list --objects --all | wc -l.
Materialized views -- REFRESH after import. Write example queries against commits and trees.
libgit2 ODB backend -- implement read/write/exists. Test by creating a libgit2 repo with the Postgres backend, writing objects through it, verifying they appear in the database.
libgit2 refdb backend -- implement CRUD + iterator. Test ref creation and lookup.
git-remote-gitgres helper -- wire up libgit2 transport so git push/clone work.
Roundtrip test -- push a repo, clone it elsewhere, diff the working trees.
C extension -- git_oid type, C hash, C tree parse. Benchmark against PL/pgSQL.
Scale test -- import homebrew-core.
Minitest. Each test connects to a gitgres_test database, runs schema setup in a BEGIN, rolls back in teardown. SQL functions tested by comparing output against git CLI on the same objects.
Roundtrip integration test: create temp repo with commits, push via the backend, clone into new directory, diff -r.
git_oid type.If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/andrew/.claude/projects/-Users-andrew-code-gitgres/0d86fef0-4a2d-473c-bb7e-29e502603055.jsonl
pkg-config --cflags --libs libpq 2>/dev/null || echo "libpq not found via pkg-config"; pg_config --libdirlibpq not found via pkg-config /opt/homebrew/lib/postgresql@14
Now I need to check a few more headers to understand the writepack and indexer interfaces.
Let me check a few more key headers and then start writing the C code and tests in parallel.
Now I have a good understanding of the libgit2 API. Let me also check the writepack structure and the reflog read/write APIs.
Let me check a few more headers I need for the writepack and reflog implementation.
Good, I have a clear picture of all the APIs now. Let me also check the git_odb_new non-experimental API and the repository wrapping API.
Now I have all the API details I need. Let me check the git_odb_add_backend function signature and the refdb creation.
Now let me check a couple more things and then write all the C files.
/opt/homebrew/Cellar/libgit2/1.9.2_1/include/git2/odb.h:97: * backend must be manually added using `git_odb_add_backend()` /opt/homebrew/Cellar/libgit2/1.9.2_1/include/git2/odb.h:637:GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority); /opt/homebrew/Cellar/libgit2/1.9.2_1/include/git2/sys/mempack.h:33: * git_odb_add_backend(odb, mempacker, 999);
No matches found
185:GIT_EXTERN(int) git_reference_create(git_reference **out, git_repository *repo, const char *name, const git_oid *id, int force, const char *log_message); 186- 187-/** 188- * Conditionally create new direct reference
35:GIT_EXTERN(int) git_refdb_new(git_refdb **out, git_repository *repo); 36- 37-/** 38- * Create a new reference database and automatically add 39- * the default backends: 40- *
Now I have everything I need. Let me write all the C backend files, the import script, and the tests. I'll use parallel agents for the larger files.
All three files are written and compile cleanly. Here's a summary of what was created: --- **`/Users/andrew/code/gitgres/backend/odb_postgres.h`** -- Public header declaring the constructor `git_odb_backend_postgres(out, conn, repo_id)`. **`/Users/andrew/code/gitgres/backend/odb_postgres.c`** -- The ODB backend implementation with all callbacks: - `pg_odb_read` -- Fetches type, size, and content from the `objects` table by exact OID. Returns data through `git_odb_backend_data_alloc`. All PQ parameters use binary format with network byte order. - `pg_odb_read_header` -- Same query minus the content column, returns only size and type. - `pg_odb_read_prefix` -- Matches OID prefixes using `substring(oid from 1 for N)`. For full-length prefixes, falls through to exact match. Returns `GIT_EAMBIGUOUS` when multiple rows match. - `pg_odb_write` -- Inserts with `ON CONFLICT DO NOTHING`. The OID comes pre-computed from libgit2. Type is sent as int16, size as int32, content as raw binary. - `pg_odb_exists` -- Returns 1 if found, 0 otherwise. - `pg_odb_exists_prefix` -- Like read_prefix but returns only the full OID. Checks ambiguity. - `pg_odb_foreach` -- Iterates all OIDs for the repo, calling the provided callback. - `pg_odb_free` -- Frees the backend struct without touching the PGconn. The constructor `git_odb_backend_postgres` allocates the struct with `calloc`, sets `GIT_ODB_BACKEND_VERSION`, wires up all callbacks including the writepack, and stores the connection and repo_id. **`/Users/andrew/code/gitgres/backend/writepack_postgres.c`** -- The writepack implementation for receiving packfiles during push: - `pg_writepack_append` -- Passes incoming pack data to `git_indexer_append`. - `pg_writepack_commit` -- After `git_indexer_commit` produces `.pack` + `.idx` files in the temp directory, it creates a temporary ODB with `git_odb_backend_one_pack`, iterates all objects via `git_odb_foreach`, reads each one, and writes it to postgres through the backend's write callback. - `pg_writepack_free` -- Frees the indexer, removes the temp directory, frees the struct. - `pg_odb_writepack` -- Creates a temp directory with a `pack/` subdirectory, initializes the indexer with the caller's progress callback, and returns the writepack. The `postgres_odb_backend` struct is defined identically in both `.c` files since writepack_postgres.c needs to cast the backend pointer. Both files compile with `-Wall -Wextra` and zero warnings against libgit2 1.9.2. agentId: af2f8d6fc444727d7 (for resuming to continue this agent's work if needed) <usage>total_tokens: 64971 tool_uses: 38 duration_ms: 569978</usage>
The project is empty. I need to:
Let me check what's in the libgit2-inspect directory and also check if I need to install libgit2.
Let me also check psql availability and whether the test database exists.
Let me plan the work with task creation and then start implementing in order. This is a massive project so let me be systematic.
Let me start with installing libgit2 and checking the database, then implement everything in build order.
Clean compile, zero warnings even with `-Wall -Wextra -pedantic`. Here's a summary of what was written. **`/Users/andrew/code/gitgres/backend/refdb_postgres.h`** -- The header exposes a single constructor function `git_refdb_backend_postgres` that takes a PGconn and repo_id and returns a `git_refdb_backend` pointer. **`/Users/andrew/code/gitgres/backend/refdb_postgres.c`** -- The full implementation, roughly 680 lines. The key pieces: **Structs:** - `postgres_refdb_backend` wraps `git_refdb_backend` with a PGconn and repo_id - `postgres_refdb_iterator` wraps `git_reference_iterator` with a cached PGresult, current position, and total count - `pg_ref_lock` holds the advisory lock key and refname for the lock/unlock pair **Helper functions:** - `hash_refname` -- FNV-1a hash of repo_id + refname, used as the pg_advisory_xact_lock key - `ref_from_result` -- builds a `git_reference` from a PGresult row using `git_reference__alloc` (direct) or `git_reference__alloc_symbolic` (symbolic) from `git2/sys/refs.h` - `repo_id_str` -- formats repo_id as decimal text for parameterized queries - `write_reflog_entry` -- inserts into the reflog table with binary OID parameters **Callbacks:** 1. `pg_refdb_exists` -- simple SELECT 1 check 2. `pg_refdb_lookup` -- fetches oid/symbolic in binary mode, returns `GIT_ENOTFOUND` if missing 3. `pg_refdb_iterator` / `pg_refdb_iter_next` / `pg_refdb_iter_next_name` / `pg_refdb_iter_free` -- loads all matching refs into a PGresult at iterator creation time, then steps through row by row. Glob patterns have `*` converted to `%` for SQL LIKE. 4. `pg_refdb_write` -- transactional upsert with compare-and-swap when `force` is false. Checks old OID/target match before writing. Writes reflog entry when a signature is provided. 5. `pg_refdb_rename` -- renames the ref and its reflog entries in a transaction, with existence checks 6. `pg_refdb_del` -- deletes ref and its reflog entries, with CAS check if old_id/old_target provided 7. Reflog stubs: `has_log` queries the reflog table, `ensure_log` is a no-op, `reflog_read` returns `GIT_ENOTFOUND` (can't construct opaque `git_reflog` through public API), `reflog_write` is a no-op (entries written in `write`), `reflog_rename`/`reflog_delete` operate on the reflog table directly 8. `pg_refdb_lock` -- starts a transaction, takes a `pg_advisory_xact_lock` keyed on the FNV-1a hash 9. `pg_refdb_unlock` -- on success=1 writes/updates the ref, on success=2 deletes it, otherwise discards. Commits or rolls back the transaction. Writes a reflog entry if update_reflog is set. 10. `pg_refdb_free` -- frees the backend struct All SQL queries use `PQexecParams` with parameterized values. OIDs are passed as binary bytea parameters (format=1, length=20). The iterator uses text-mode results so that `PQgetvalue` returns NUL-terminated strings for ref names and symbolic targets. agentId: a9ffefe4de866716e (for resuming to continue this agent's work if needed) <usage>total_tokens: 60769 tool_uses: 46 duration_ms: 577803</usage>
Both files are complete and correct. Here is a summary of what was written: --- **`/Users/andrew/code/gitgres/backend/main.c`** (519 lines) A CLI tool that transfers git objects and refs between local filesystem repos and the PostgreSQL-backed git store. It links against libgit2 and libpq, and uses the custom `odb_postgres` and `refdb_postgres` backends declared in the companion headers. Four subcommands: - **`init <conninfo> <reponame>`** -- Upserts a row in `repositories` and prints the repo ID. - **`push <conninfo> <reponame> <local-repo-path>`** -- Opens the local git repo, iterates every object via `git_odb_foreach`, reads each one from the local ODB, and writes it into the postgres-backed ODB. Then iterates all refs with `git_reference_iterator`, creating corresponding direct or symbolic refs in the postgres-backed refdb. HEAD is handled separately via a direct SQL insert into the `refs` table (because libgit2's refdb won't let you create HEAD on a repo created with `git_repository_new`). - **`clone <conninfo> <reponame> <dest-dir>`** -- Creates a fresh local repo with `git_repository_init`, copies all objects from postgres to local via `git_odb_foreach`, reads refs from the `refs` table with a direct SQL query and creates them in the local repo, sets HEAD with `git_repository_set_head`, then runs `git_checkout_head` with `GIT_CHECKOUT_FORCE` to populate the working directory. - **`ls-refs <conninfo> <reponame>`** -- Queries the `refs` table and prints each ref. Symbolic refs are shown with a `->` prefix, direct refs show the hex OID. The `open_pg_repo` helper builds an in-memory libgit2 `git_repository` with no filesystem backing. It creates a fresh ODB, attaches the postgres ODB backend, then creates a refdb and attaches the postgres refdb backend. This gives libgit2 a fully functional repo object where all reads/writes go through postgres. Error handling uses `check_lg2` for libgit2 calls (fatal on failure) and warnings for non-fatal per-object/per-ref failures during push/clone, so a single bad object doesn't abort the entire transfer. **`/Users/andrew/code/gitgres/backend/Makefile`** (27 lines) Builds `gitgres-backend` from `main.o`, `odb_postgres.o`, `refdb_postgres.o`, and `writepack_postgres.o`. Uses `pkg-config` for libgit2 flags and `pg_config` for PostgreSQL include/lib paths. The `PG_CONFIG` variable defaults to `pg_config` (matching the top-level Makefile's convention) rather than hardcoding a Postgres.app path. agentId: a39304b2e3d2e3d67 (for resuming to continue this agent's work if needed) <usage>total_tokens: 80910 tool_uses: 42 duration_ms: 210077</usage>
Good, the C backend files are written. Now let me write the import script, C extension, and tests in parallel.
chmod +x /Users/andrew/code/gitgres/import/gitgres-import.sh(empty result)
psql --version && psql -c "SELECT version();" postgres 2>&1 | head -5psql (PostgreSQL) 14.18 (Homebrew)
version
-------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 16.12 (Postgres.app) on aarch64-apple-darwin21.6.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.102), 64-bit
(1 row)Now let me write all the test files and the C extension in parallel.
All seven files are in place. Here is a summary of what was written: **`/Users/andrew/code/gitgres/ext/gitgres.control`** -- Extension metadata telling PostgreSQL the extension name, version, and shared library path. **`/Users/andrew/code/gitgres/ext/Makefile`** -- PGXS-based build file that compiles all four `.c` files into a single `gitgres.so` shared library. Links against OpenSSL for SHA1 support via pkg-config with a fallback to `-lssl -lcrypto`. **`/Users/andrew/code/gitgres/ext/gitgres.c`** -- Module entry point with `PG_MODULE_MAGIC` (required for PostgreSQL to load the shared library) and an empty `_PG_init` hook. **`/Users/andrew/code/gitgres/ext/git_oid_type.c`** -- Implements the `git_oid` custom type as a fixed 20-byte pass-by-reference struct. Includes: - `git_oid_in`: parses a 40-character hex string into 20 bytes - `git_oid_out`: converts 20 bytes back to a 40-char hex string - All six comparison functions (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) using `memcmp` - `git_oid_cmp`: three-way comparison for btree indexing - `git_oid_hash`: hash function using PostgreSQL's `hash_any` **`/Users/andrew/code/gitgres/ext/sha1_hash.c`** -- Implements `git_object_hash_c(type smallint, content bytea)` which computes the git object hash by SHA1-hashing the header (`"<type> <size>\0"`) followed by the content. Maps type codes 1-4 to commit/tree/blob/tag. **`/Users/andrew/code/gitgres/ext/tree_parse.c`** -- Implements `git_tree_entries_c(bytea)` as a set-returning function (SRF). Parses the binary tree format (`<mode> <name>\0<20-byte-oid>` repeated) and returns rows of `(mode text, name text, entry_oid bytea)`. Includes bounds-checking error reporting for malformed data. **`/Users/andrew/code/gitgres/ext/sql/gitgres--0.1.sql`** -- The SQL script that `CREATE EXTENSION gitgres` runs. Defines the `git_oid` type with I/O functions, all six comparison operators with proper commutator/negator/selectivity annotations, btree and hash operator classes for indexing, and the two C utility functions. agentId: ac5a64dc6fb3e64df (for resuming to continue this agent's work if needed) <usage>total_tokens: 25025 tool_uses: 9 duration_ms: 134370</usage>
All 8 test files have been written: 1. `/Users/andrew/code/gitgres/test/test_helper.rb` -- Base test class with PG connection setup, transaction wrapping, and helpers for writing objects, computing git hashes, and creating temporary repos. 2. `/Users/andrew/code/gitgres/test/schema_test.rb` -- Verifies the `repositories`, `objects`, `refs`, and `reflog` tables exist and that constraints work (foreign key on `objects.repo_id`, check constraint requiring exactly one of `oid`/`symbolic` on `refs`). 3. `/Users/andrew/code/gitgres/test/object_hash_test.rb` -- Tests `git_object_hash` and `git_type_name` functions. Verifies SHA1 hashing matches `git hash-object` for empty blobs, regular strings, binary content, and large blobs. 4. `/Users/andrew/code/gitgres/test/object_store_test.rb` -- Tests `git_object_write` and `git_object_read`. Covers write/read roundtrip, correct OID generation, idempotent writes, reading nonexistent objects, and storing multiple object types. 5. `/Users/andrew/code/gitgres/test/tree_parse_test.rb` -- Tests `git_tree_entries` and `git_ls_tree_r`. Creates real git repos with single files, multiple files with subdirectories, and verifies the SQL functions parse tree binary content correctly. The recursive test imports objects into the database and walks the tree. 6. `/Users/andrew/code/gitgres/test/commit_parse_test.rb` -- Tests `git_commit_parse` by creating real git commits with controlled timestamps and verifying the parsed tree OID, author name/email, timestamp, and commit message. Also tests parent OID extraction from a second commit. 7. `/Users/andrew/code/gitgres/test/ref_test.rb` -- Tests `git_ref_update` and `git_ref_set_symbolic`. Covers creating refs, compare-and-swap updates (success and failure), force updates, symbolic refs, and deletion via zero OID. 8. `/Users/andrew/code/gitgres/test/roundtrip_test.rb` -- Integration tests that create real git repos with multiple commits, import all objects into the database, and verify object counts, OID correctness, and commit parsing via `LATERAL` joins. agentId: abe2c86d8f6c5f548 (for resuming to continue this agent's work if needed) <usage>total_tokens: 28784 tool_uses: 9 duration_ms: 91383</usage>
Good, all the files are written. Now let me verify everything compiles and the tests pass. Let me first check the pg gem is available, then run the tests.
gem list pg 2>&1 | head -5pg (1.6.3 arm64-darwin, 1.6.2 ruby arm64-darwin) pg_query (6.1.0) pg_search (2.3.7) pghero (3.7.0, 3.5.0) pgvector (0.3.2)
ls /Users/andrew/code/gitgres/backend/main.c main.o Makefile odb_postgres.c odb_postgres.h refdb_postgres.c refdb_postgres.h refdb_postgres.o writepack_postgres.c
ls /Users/andrew/code/gitgres/test/commit_parse_test.rb object_hash_test.rb object_store_test.rb ref_test.rb roundtrip_test.rb schema_test.rb test_helper.rb tree_parse_test.rb
Let me first drop and recreate the test database cleanly, then run the tests.
dropdb gitgres_test 2>/dev/null; createdb gitgres_test && psql -f sql/schema.sql gitgres_test 2>&1 && psql -f sql/functions/object_hash.sql gitgres_test 2>&1 && psql -f sql/functions/object_read_write.sql gitgres_test 2>&1 && psql -f sql/functions/tree_parse.sql gitgres_test 2>&1 && psql -f sql/functions/commit_parse.sql gitgres_test 2>&1 && psql -f sql/functions/ref_manage.sql gitgres_test 2>&1CREATE EXTENSION CREATE TABLE CREATE TABLE CREATE INDEX CREATE TABLE CREATE TABLE CREATE INDEX CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION
ruby -Itest -e 'Dir.glob("test/*_test.rb").sort.each { |f| require_relative f }' 2>&1Run options: --seed 5931 # Running: .............................. Finished in 2.636804s, 11.3774 runs/s, 29.5813 assertions/s. 30 runs, 78 assertions, 0 failures, 0 errors, 0 skips
All 30 tests pass. Now let me try building the C backend.
cd /Users/andrew/code/gitgres/backend && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1cc -Wall -g -O2 -I/opt/homebrew/Cellar/libgit2/1.9.2_1/include -I/Applications/Postgres.app/Contents/Versions/16/include -c odb_postgres.c -o odb_postgres.o cc -Wall -g -O2 -I/opt/homebrew/Cellar/libgit2/1.9.2_1/include -I/Applications/Postgres.app/Contents/Versions/16/include -c writepack_postgres.c -o writepack_postgres.o cc -o gitgres-backend main.o odb_postgres.o refdb_postgres.o writepack_postgres.o -L/opt/homebrew/Cellar/libgit2/1.9.2_1/lib -lgit2 -L/Applications/Postgres.app/Contents/Versions/16/lib -lpq
ls -la /private/tmp/libgit2-inspect/Exit code 1 ls: /private/tmp/libgit2-inspect/: No such file or directory ls: /private/tmp/libgit2-inspect/: No such file or directory
Backend compiles. Let me now try building the C extension.
cd /Users/andrew/code/gitgres/ext && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1Exit code 2
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o gitgres.o gitgres.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o git_oid_type.o git_oid_type.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o sha1_hash.o sha1_hash.c
sha1_hash.c:41:19: error: call to undeclared function 'VARSIZE_ANY_EXHDR'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
41 | content_len = VARSIZE_ANY_EXHDR(content);
| ^
sha1_hash.c:47:23: error: call to undeclared function 'VARDATA_ANY'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
47 | SHA1_Update(&ctx, VARDATA_ANY(content), content_len);
| ^
sha1_hash.c:47:23: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
47 | SHA1_Update(&ctx, VARDATA_ANY(content), content_len);
| ^~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/sha.h:50:63: note: passing argument to parameter 'data' here
50 | OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
| ^
sha1_hash.c:51:5: error: call to undeclared function 'SET_VARSIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
51 | SET_VARSIZE(result, VARHDRSZ + 20);
| ^
sha1_hash.c:52:12: error: call to undeclared function 'VARDATA'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
52 | memcpy(VARDATA(result), hash, 20);
| ^
sha1_hash.c:52:12: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
52 | memcpy(VARDATA(result), hash, 20);
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:234:40: note: expanded from macro 'memcpy'
234 | #define memcpy(...) __memcpy_chk_func (__VA_ARGS__)
| ^~~~~~~~~~~
/Library/Developer/C
... [2694 characters truncated] ...
-arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o git_oid_type.o git_oid_type.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o sha1_hash.o sha1_hash.c
sha1_hash.c:41:19: error: call to undeclared function 'VARSIZE_ANY_EXHDR'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
41 | content_len = VARSIZE_ANY_EXHDR(content);
| ^
sha1_hash.c:47:23: error: call to undeclared function 'VARDATA_ANY'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
47 | SHA1_Update(&ctx, VARDATA_ANY(content), content_len);
| ^
sha1_hash.c:47:23: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
47 | SHA1_Update(&ctx, VARDATA_ANY(content), content_len);
| ^~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/sha.h:50:63: note: passing argument to parameter 'data' here
50 | OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
| ^
sha1_hash.c:51:5: error: call to undeclared function 'SET_VARSIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
51 | SET_VARSIZE(result, VARHDRSZ + 20);
| ^
sha1_hash.c:52:12: error: call to undeclared function 'VARDATA'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
52 | memcpy(VARDATA(result), hash, 20);
| ^
sha1_hash.c:52:12: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
52 | memcpy(VARDATA(result), hash, 20);
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:234:40: note: expanded from macro 'memcpy'
234 | #define memcpy(...) __memcpy_chk_func (__VA_ARGS__)
| ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:127:62: note: expanded from macro '__memcpy_chk_func'
127 | __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
| ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_common.h:40:55: note: expanded from macro '__darwin_obsz0'
40 | #define __darwin_obsz0(object) __builtin_object_size (object, 0)
| ^~~~~~
sha1_hash.c:52:12: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
52 | memcpy(VARDATA(result), hash, 20);
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:234:40: note: expanded from macro 'memcpy'
234 | #define memcpy(...) __memcpy_chk_func (__VA_ARGS__)
| ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:127:27: note: expanded from macro '__memcpy_chk_func'
127 | __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
| ^~~~
7 errors generated.
make: *** [sha1_hash.o] Error 1Missing includes in sha1_hash.c. Let me fix it and also check tree_parse.c.
The sha1_hash.c is missing #include "utils/builtins.h" which provides VARSIZE_ANY_EXHDR, VARDATA_ANY, etc. Let me also use the EVP API since the legacy SHA1 functions are deprecated in OpenSSL 3.
cd /Users/andrew/code/gitgres/ext && make clean 2>/dev/null; make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1Exit code 2
rm -f gitgres.so libgitgres.a libgitgres.pc
rm -f gitgres.o git_oid_type.o sha1_hash.o tree_parse.o gitgres.bc git_oid_type.bc sha1_hash.bc tree_parse.bc
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o gitgres.o gitgres.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o git_oid_type.o git_oid_type.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Os -mmacosx-version-min=10.13 -arch arm64 -arch x86_64 -fvisibility=hidden -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/opt/homebrew/Cellar/openssl@3/3.6.1/include -I. -I./ -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/16/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/include -I/Applications/Postgres.app/Contents/Versions/16/share/icu -c -o sha1_hash.o sha1_hash.c
In file included from sha1_hash.c:5:
In file included from /opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/evp.h:26:
In file included from /opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/types.h:33:
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/safestack.h:231:1: warning: cast from 'OPENSSL_sk_freefunc' (aka 'void (*)(void *)') to 'sk_OPENSSL_STRING_freefunc' (aka 'void (*)(char *)') converts to incompatible function type [-Wcast-function-type-strict]
231 | SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_STRING, char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/safestack.h:43:39: note: expanded from macro 'SKM_DEFINE_STACK_OF_INTERNAL'
43 | sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc)freefunc_arg; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/safestack.h:231:1: warning: cast from 'sk_OPENSSL_STRING_compfunc' (aka 'int (*)(const char *const *, const char *const *)') to 'OPENSSL_sk_compfunc' (aka 'int (*)(const void *, const void *)') converts to incompatible function type [-Wcast-function-type-strict]
231 | SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_STRING, char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/safestack.h:60:16: note: expanded from macro 'SKM_DEFINE_STACK_OF_INTERNAL'
60 | return (OPENSSL_sk_compfunc)cmp; \
| ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/safestack.h:231:1: warning: cast from 'sk_OPENSSL_STRING_copyfunc' (aka 'char *(*)(const char *)') to 'O
... [50013 characters truncated] ...
3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:132:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_CRYPTO_secure_malloc_fn *' (aka 'void *(*)(unsigned long, const char *, int)') converts to incompatible function type [-Wcast-function-type-strict]
132 | OSSL_CORE_MAKE_FUNC(void *,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | CRYPTO_secure_malloc, (size_t num, const char *file, int line))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:135:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_CRYPTO_secure_zalloc_fn *' (aka 'void *(*)(unsigned long, const char *, int)') converts to incompatible function type [-Wcast-function-type-strict]
135 | OSSL_CORE_MAKE_FUNC(void *,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
136 | CRYPTO_secure_zalloc, (size_t num, const char *file, int line))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:138:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_CRYPTO_secure_free_fn *' (aka 'void (*)(void *, const char *, int)') converts to incompatible function type [-Wcast-function-type-strict]
138 | OSSL_CORE_MAKE_FUNC(void,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
139 | CRYPTO_secure_free, (void *ptr, const char *file, int line))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:141:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_CRYPTO_secure_clear_free_fn *' (aka 'void (*)(void *, unsigned long, const char *, int)') converts to incompatible function type [-Wcast-function-type-strict]
141 | OSSL_CORE_MAKE_FUNC(void,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
142 | CRYPTO_secure_clear_free, (void *ptr, size_t num, const char *file, int line))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:144:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_CRYPTO_secure_allocated_fn *' (aka 'int (*)(const void *)') converts to incompatible function type [-Wcast-function-type-strict]
144 | OSSL_CORE_MAKE_FUNC(int,
| ^~~~~~~~~~~~~~~~~~~~~~~~
145 | CRYPTO_secure_allocated, (const void *ptr))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:147:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_OPENSSL_cleanse_fn *' (aka 'void (*)(void *, unsigned long)') converts to incompatible function type [-Wcast-function-type-strict]
147 | OSSL_CORE_MAKE_FUNC(void,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
148 | OPENSSL_cleanse, (void *ptr, size_t len))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:61:16: note: expanded from macro 'OSSL_CORE_MAKE_FUNC'
61 | return (OSSL_FUNC_##name##_fn *)opf->function; \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/openssl@3/3.6.1/include/openssl/core_dispatch.h:163:1: warning: cast from 'void (*)(void)' to 'OSSL_FUNC_BIO_new_file_fn *' (aka 'struct ossl_core_bio_st *(*)(const char *, const char *)') converts to incompatible function type [-Wcast-function-type-strict]
163 | OSSL_CORE_MAKE_FUNC(OSSL_CORE_BIO *, BIO_new_file, (const char *filename, const char *mode))
| ^~~~~~~~~~~Tons of OpenSSL warnings (from the -Wcast-function-type flag in PGXS) but I need to check if it actually linked. Let me look at the end more carefully.
cd /Users/andrew/code/gitgres/ext && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | tail -20/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:234:40: note: expanded from macro 'memcpy'
234 | #define memcpy(...) __memcpy_chk_func (__VA_ARGS__)
| ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:127:62: note: expanded from macro '__memcpy_chk_func'
127 | __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
| ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_common.h:40:55: note: expanded from macro '__darwin_obsz0'
40 | #define __darwin_obsz0(object) __builtin_object_size (object, 0)
| ^~~~~~
sha1_hash.c:64:12: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
64 | memcpy(VARDATA(result), hash, 20);
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:234:40: note: expanded from macro 'memcpy'
234 | #define memcpy(...) __memcpy_chk_func (__VA_ARGS__)
| ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:127:27: note: expanded from macro '__memcpy_chk_func'
127 | __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
| ^~~~
320 warnings and 7 errors generated.
make: *** [sha1_hash.o] Error 1The issue is that VARDATA and SET_VARSIZE are still failing. The problem is that the PGXS build is compiling for both arm64 and x86_64 (-arch arm64 -arch x86_64). On one arch (likely x86_64) the builtins.h isn't resolving properly. Let me check what's happening more carefully.
Actually, looking at the errors more carefully: VARDATA(result) is returning int instead of void*. This suggests the macro isn't being properly resolved. This is actually a Postgres.app issue - the server headers for PG 16 built for universal binary have this problem with some macros.
I'm wondering if the postgres.h include path is incomplete or if I need to pull in additional headers to get VARDATA properly defined for the x86_64 target. to parameter of type 'void *'forVARDATA(result)`. The fact that it's returning int suggests the macro isn't expanded properly.
Wait, I see #include "utils/builtins.h" is included now. The issue might be that VARDATA is defined in postgres.h via varatt.h or varlena.h. Let me check what header defines VARDATA in PG 16.
Actually, in PG 16, VARDATA should be defined in postgres.h -> c.h -> varatt.h. Let me double-check.
Actually, the real issue might be the dual-architecture build. When building for x86_64 on arm64 mac, some headers might not resolve correctly. But more likely, there's a specific include missing. Let me just check by adding #include "varatt.h" explicitly, which was introduced in PG 16.
The issue is that PG 16 moved VARDATA macros to varatt.h. Let me fix the includes.
brew list libgit2 2>/dev/null || echo "libgit2 not installed via homebrew"<tool_use_error>Sibling tool call errored</tool_use_error>
ls /Applications/Postgres.app/Contents/Versions/16/include/postgresql/server/varatt.h 2>/dev/null && echo "varatt.h exists"/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server/varatt.h varatt.h exists
/Applications/Postgres.app/Contents/Versions/16/include/postgresql/server/varatt.h:278:#define VARDATA(PTR) VARDATA_4B(PTR)
rm -f sha1_hash.o && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -E '(error:|gitgres\.so|^make:)' | head -20(empty result)
rm -f *.o && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -v 'warning:' | grep -v '^ ' | grep -v '^$' | grep -v 'note:'make: Nothing to be done for `all'.
This is a large project implementation. Let me break it down and start working through the build order systematically. Let me first understand what already exists in the repo, then start implementing.
Let me check the current state of the project first.
rm -f *.o gitgres.so && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -cE '^.*error:' ; echo "---"; make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -E '(^gcc.*-o gitgres|error:|^make:)' | tail -5(eval):1: no matches found: *.o --- make: Nothing to be done for `all'.
make clean PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 && make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -cE 'error:'; ls -la gitgres.so 2>/dev/null || echo "No .so file"rm -f gitgres.dylib libgitgres.a libgitgres.pc rm -f gitgres.o git_oid_type.o sha1_hash.o tree_parse.o gitgres.bc git_oid_type.bc sha1_hash.bc tree_parse.bc 0 No .so file
ls -la gitgres.dylib 2>/dev/null || echo "No dylib"; ls -la *.o 2>/dev/null || echo "No .o files"-rwxr-xr-x 1 andrew staff 86768 23 Feb 09:16 gitgres.dylib -rw-r--r-- 1 andrew staff 37728 23 Feb 09:16 git_oid_type.o -rw-r--r-- 1 andrew staff 33608 23 Feb 09:16 gitgres.o -rw-r--r-- 1 andrew staff 36192 23 Feb 09:16 sha1_hash.o -rw-r--r-- 1 andrew staff 36760 23 Feb 09:16 tree_parse.o
Extension builds successfully (it's .dylib on macOS). Zero errors, just OpenSSL warnings from their headers. Let me now do a quick integration test - install the extension and verify it works.
sudo make install PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config 2>&1 | grep -v warning | grep -v notesudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required
# Postgres.app allows installs without sudo if we target the right dir
PKGLIBDIR=$(/Applications/Postgres.app/Contents/Versions/16/bin/pg_config --pkglibdir)
SHAREDIR=$(/Applications/Postgres.app/Contents/Versions/16/bin/pg_config --sharedir)
echo "pkglib: $PKGLIBDIR"
echo "share: $SHAREDIR"
ls -la "$PKGLIBDIR" 2>&1 | head -3
cp gitgres.dylib "$PKGLIBDIR/" 2>&1
cp gitgres.control "$SHAREDIR/extension/" 2>&1
cp sql/gitgres--0.1.sql "$SHAREDIR/extension/" 2>&1
echo "Installed."pkglib: /Applications/Postgres.app/Contents/Versions/16/lib/postgresql share: /Applications/Postgres.app/Contents/Versions/16/share/postgresql total 67752 -rwxr-xr-x 1 andrew admin 214400 11 Feb 16:32 _int.dylib drwxr-xr-x 97 andrew admin 3104 11 Feb 16:33 . cp: /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/gitgres.dylib: Operation not permitted cp: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/gitgres.control: Operation not permitted cp: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/gitgres--0.1.sql: Operation not permitted Installed.
brew list libgit2 2>/dev/null || echo "libgit2 not installed via homebrew"libgit2 not installed via homebrew
ls -la /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/_int.dylib-rwxr-xr-x 1 andrew admin 214400 11 Feb 16:32 /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/_int.dylib
Owned by andrew but "Operation not permitted" - likely SIP. Let me try with install.
PKGLIBDIR=$(/Applications/Postgres.app/Contents/Versions/16/bin/pg_config --pkglibdir)
SHAREDIR=$(/Applications/Postgres.app/Contents/Versions/16/bin/pg_config --sharedir)
install -m 755 gitgres.dylib "$PKGLIBDIR/gitgres.dylib" 2>&1
install -m 644 gitgres.control "$SHAREDIR/extension/gitgres.control" 2>&1
install -m 644 sql/gitgres--0.1.sql "$SHAREDIR/extension/gitgres--0.1.sql" 2>&1Exit code 71 install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/INS@aOszkC: Operation not permitted install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/INS@IeBuyI: Operation not permitted install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/INS@7yottu: Operation not permitted install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/INS@aOszkC: Operation not permitted install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/INS@IeBuyI: Operation not permitted install: sandbox detected, falling back to direct copy install: /Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/INS@7yottu: Operation not permitted
Sandbox restriction on Postgres.app. The C extension builds but can't be installed without disabling SIP protections on the app bundle. That's fine - the extension is a build step 9 optimization item. The core functionality (PL/pgSQL functions + libgit2 backend) all works without it.
Let me now do a proper end-to-end test with the backend binary. Let me first test the import script with a small repo.
cd /Users/andrew/code/gitgres && /Users/andrew/code/gitgres/backend/gitgres-backend 2>&1Exit code 1
Usage: gitgres-backend <command> [args]
Commands:
init <conninfo> <reponame>
push <conninfo> <reponame> <local-repo-path>
clone <conninfo> <reponame> <dest-dir>
ls-refs <conninfo> <reponame>
Usage: gitgres-backend <command> [args]
Commands:
init <conninfo> <reponame>
push <conninfo> <reponame> <local-repo-path>
clone <conninfo> <reponame> <dest-dir>
ls-refs <conninfo> <reponame>Let me do the roundtrip test - create a repo, push it, clone it, diff the working trees.
psql -c "SELECT 1 FROM pg_database WHERE datname='gitgres_test'" postgres?column? ---------- (0 rows)
# Create a test repo
TEST_DIR=$(mktemp -d)
cd "$TEST_DIR" && git init test-repo && cd test-repo
git config user.email "test@test.com"
git config user.name "Test User"
echo "hello world" > hello.txt
mkdir sub
echo "nested file" > sub/nested.txt
git add .
git commit -m "initial commit"
echo "second line" >> hello.txt
git add .
git commit -m "second commit"
echo "Test repo at: $TEST_DIR/test-repo"
git log --oneline
git rev-list --objects --all | wc -lInitialized empty Git repository in /private/var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.i3RGDfm76x/test-repo/.git/
[main (root-commit) f4134c5] initial commit
2 files changed, 2 insertions(+)
create mode 100644 hello.txt
create mode 100644 sub/nested.txt
[main 931dd65] second commit
1 file changed, 1 insertion(+)
Test repo at: /var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.i3RGDfm76x/test-repo
931dd65 second commit
f4134c5 initial commit
8
Shell cwd was reset to /Users/andrew/code/gitgres/Users/andrew/code/gitgres/backend/gitgres-backend init "dbname=gitgres_test" roundtrip_test 2>&1Repository 'roundtrip_test' ready (id=31)
/Users/andrew/code/gitgres/backend/gitgres-backend push "dbname=gitgres_test" roundtrip_test "/var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.i3RGDfm76x/test-repo" 2>&1Pushed 8 objects Pushed 1 refs
/Users/andrew/code/gitgres/backend/gitgres-backend ls-refs "dbname=gitgres_test" roundtrip_test 2>&1-> refs/heads/main HEAD 931dd65a714b621a9c3903ea0584ec0d10997748 refs/heads/main
Now clone it back and diff.
CLONE_DIR=$(mktemp -d)/clone
/Users/andrew/code/gitgres/backend/gitgres-backend clone "dbname=gitgres_test" roundtrip_test "$CLONE_DIR" 2>&1Cloned 8 objects Cloned 1 refs Checked out working directory
CLONE_DIR=$(ls -dt /tmp/tmp.*/clone 2>/dev/null | head -1 || ls -dt /var/folders/*/T/tmp.*/clone 2>/dev/null | head -1)
echo "Clone at: $CLONE_DIR"
# Find it by searching for the clone we just made
find /var/folders -name "clone" -type d -newer /Users/andrew/code/gitgres/backend/gitgres-backend 2>/dev/null | head -3(eval):1: no matches found: /tmp/tmp.*/clone Clone at: /var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.MG6xBQn8uc/clone
CLONE_DIR="/var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.MG6xBQn8uc/clone"
ORIG_DIR="/var/folders/8m/47w09vss1bqg72tlz9xcxl6h0000gn/T/tmp.i3RGDfm76x/test-repo"
echo "=== Original ==="
ls -la "$ORIG_DIR"
echo
echo "=== Clone ==="
ls -la "$CLONE_DIR"
echo
echo "=== Diff ==="
diff -r --exclude=.git "$ORIG_DIR" "$CLONE_DIR" && echo "IDENTICAL" || echo "DIFFERENT"
echo
echo "=== Clone git log ==="
git -C "$CLONE_DIR" log --oneline
echo
echo "=== File contents ==="
cat "$CLONE_DIR/hello.txt"
cat "$CLONE_DIR/sub/nested.txt"=== Original === total 8 drwxr-xr-x 5 andrew staff 160 23 Feb 09:17 . drwx------ 3 andrew staff 96 23 Feb 09:17 .. drwxr-xr-x 14 andrew staff 448 23 Feb 09:17 .git -rw-r--r-- 1 andrew staff 24 23 Feb 09:17 hello.txt drwxr-xr-x 3 andrew staff 96 23 Feb 09:17 sub === Clone === total 8 drwxr-xr-x 5 andrew staff 160 23 Feb 09:18 . drwx------ 3 andrew staff 96 23 Feb 09:18 .. drwxr-xr-x 11 andrew staff 352 23 Feb 09:18 .git -rw-r--r-- 1 andrew staff 24 23 Feb 09:18 hello.txt drwxr-xr-x 3 andrew staff 96 23 Feb 09:18 sub === Diff === IDENTICAL === Clone git log === 931dd65 second commit f4134c5 initial commit === File contents === hello world second line nested file
Full roundtrip works. Push to Postgres, clone back, working trees are identical, git history is preserved.
Let me update the task status and also verify the materialized views work.
Updated task #2 status
Updated task #3 status
Updated task #4 status
psql -f sql/views/queryable.sql gitgres_test 2>&1SELECT 2 CREATE INDEX SELECT 5 CREATE INDEX
psql gitgres_test -c "SELECT sha, author_name, authored_at, left(message, 40) as message FROM commits_view ORDER BY authored_at" 2>&1 sha | author_name | authored_at | message
------------------------------------------+-------------+------------------------+----------------
f4134c562b8006e9bf45d42b2ee21ac4e833067a | Test User | 2026-02-23 09:17:35+00 | initial commit+
| | |
931dd65a714b621a9c3903ea0584ec0d10997748 | Test User | 2026-02-23 09:17:36+00 | second commit +
| | |
(2 rows)psql gitgres_test -c "SELECT encode(tree_oid, 'hex') as tree, mode, name, encode(entry_oid, 'hex') as entry FROM tree_entries_view ORDER BY name" 2>&1tree | mode | name | entry ------------------------------------------+--------+------------+------------------------------------------ e271b26ec818bbe4ff179f217d9313f64a48292d | 100644 | hello.txt | f0e9ea9cdcd1c7d022373365088a65e94c5ab13e e8f069922918155bebe3dc8ae1c712c95c70eb14 | 100644 | hello.txt | 3b18e512dba79e4c8300dd08aeb37f8e728b8dad ffd768cc02140d4a0d756f1b46c8834fe658a0fd | 100644 | nested.txt | 6bd82e79b62ea4c56e352fca7f71addc4484275b e271b26ec818bbe4ff179f217d9313f64a48292d | 40000 | sub | ffd768cc02140d4a0d756f1b46c8834fe658a0fd e8f069922918155bebe3dc8ae1c712c95c70eb14 | 40000 | sub | ffd768cc02140d4a0d756f1b46c8834fe658a0fd (5 rows)
Everything works. Let me now run the full test suite one more time and then mark tests complete.
ruby -Itest -e 'Dir.glob("test/*_test.rb").sort.each { |f| require_relative f }' 2>&1Run options: --seed 21461 # Running: .............................. Finished in 2.603430s, 11.5233 runs/s, 29.9605 assertions/s. 30 runs, 78 assertions, 0 failures, 0 errors, 0 skips
The user mentions switching to Postgres 18. Let me check what's available. The psql client is 14.18 (Homebrew) but the server is 16.12 (Postgres.app). Let me check what Postgres versions are available.
Actually, the key issue is that the pg_config is for PostgreSQL 14, but the server running is PostgreSQL 16. This mismatch could cause issues when building the C extension. Let me check if there's a pg_config for PG 16 from Postgres.app.
But the user said we can switch to 18 if easier. Let me check what's available and assess whether the version matters for our initial implementation. For the pure SQL parts and libgit2 backend, the PG version doesn't matter much.
I'll start with what doesn't depend on the C extension—setting up the SQL schema, PL/pgSQL functions, import script, and tests. I need to install libgit2 first, then create the test database and begin building.
Updated task #5 status
Let me also initialize a git repo for the project, now that you mentioned wanting a Makefile (the top-level one already exists).
The server is PG 16 (Postgres.app) but the pg_config client is PG 14 (Homebrew). For the C extension we need matching headers, but for everything else it doesn't matter much. Let me check what's available and get started.
All three Makefiles exist and work. The top-level one you asked about was already created.
Let me also update it to exclude the views from createdb since they depend on data existing, and fix the test runner path.
Now let me initialize the git repo and take a look at the final file list.
git init 2>&1Initialized empty Git repository in /Users/andrew/code/gitgres/.git/
ls /Applications/Postgres.app/Contents/Versions/*/bin/pg_config 2>/dev/nullfind /Users/andrew/code/gitgres -not -path '*/.git/*' -not -path '*/.claude/*' -not -name '*.o' -not -name '*.dylib' -not -name 'gitgres-backend' -type f | sort/Users/andrew/code/gitgres/.gitignore /Users/andrew/code/gitgres/backend/main.c /Users/andrew/code/gitgres/backend/Makefile /Users/andrew/code/gitgres/backend/odb_postgres.c /Users/andrew/code/gitgres/backend/odb_postgres.h /Users/andrew/code/gitgres/backend/refdb_postgres.c /Users/andrew/code/gitgres/backend/refdb_postgres.h /Users/andrew/code/gitgres/backend/writepack_postgres.c /Users/andrew/code/gitgres/ext/git_oid_type.c /Users/andrew/code/gitgres/ext/gitgres.c /Users/andrew/code/gitgres/ext/gitgres.control /Users/andrew/code/gitgres/ext/Makefile /Users/andrew/code/gitgres/ext/sha1_hash.c /Users/andrew/code/gitgres/ext/sql/gitgres--0.1.sql /Users/andrew/code/gitgres/ext/tree_parse.c /Users/andrew/code/gitgres/import/gitgres-import.sh /Users/andrew/code/gitgres/Makefile /Users/andrew/code/gitgres/sql/functions/commit_parse.sql /Users/andrew/code/gitgres/sql/functions/object_hash.sql /Users/andrew/code/gitgres/sql/functions/object_read_write.sql /Users/andrew/code/gitgres/sql/functions/ref_manage.sql /Users/andrew/code/gitgres/sql/functions/tree_parse.sql /Users/andrew/code/gitgres/sql/schema.sql /Users/andrew/code/gitgres/sql/views/queryable.sql /Users/andrew/code/gitgres/test/commit_parse_test.rb /Users/andrew/code/gitgres/test/object_hash_test.rb /Users/andrew/code/gitgres/test/object_store_test.rb /Users/andrew/code/gitgres/test/ref_test.rb /Users/andrew/code/gitgres/test/roundtrip_test.rb /Users/andrew/code/gitgres/test/schema_test.rb /Users/andrew/code/gitgres/test/test_helper.rb /Users/andrew/code/gitgres/test/tree_parse_test.rb
Here's the final state of the project:
SQL layer (all working, tested):
sql/schema.sql - tables for repositories, objects, refs, reflog with pgcryptosql/functions/ - PL/pgSQL functions: git_object_hash, git_object_write, git_object_read, git_tree_entries, git_ls_tree_r, git_commit_parse, git_ref_update, git_ref_set_symbolicsql/views/queryable.sql - materialized views for commits and tree entrieslibgit2 backend (compiles, roundtrip verified):
backend/odb_postgres.c - ODB backend storing objects in Postgres via libpqbackend/refdb_postgres.c - refdb backend storing refs in Postgresbackend/writepack_postgres.c - pack file receiver using libgit2's indexerbackend/main.c - CLI tool with init, push, clone, ls-refs commandsC extension (compiles, can't install to Postgres.app due to sandbox):
ext/git_oid_type.c - custom 20-byte git_oid type with btree/hash operator classesext/sha1_hash.c - C SHA1 via OpenSSL EVP APIext/tree_parse.c - C tree entry parser as SRFImport script: import/gitgres-import.sh - imports repos via git plumbing + psql
Tests: 30 tests, 78 assertions, all passing. Covers schema constraints, object hashing (verified against git hash-object), object store CRUD, tree parsing, commit parsing, ref CAS updates, and a roundtrip integration test.
Verified roundtrip: pushed a 2-commit repo to Postgres, cloned it back, diff -r shows identical working trees, git log preserved.
ok lets add a readme and git init a repo and commit with "Hello world"
git -C /Users/andrew/code/gitgres status -uOn branch main No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore Makefile README.md backend/Makefile backend/main.c backend/odb_postgres.c backend/odb_postgres.h backend/refdb_postgres.c backend/refdb_postgres.h backend/writepack_postgres.c ext/Makefile ext/git_oid_type.c ext/gitgres.c ext/gitgres.control ext/sha1_hash.c ext/sql/gitgres--0.1.sql ext/tree_parse.c import/gitgres-import.sh sql/functions/commit_parse.sql sql/functions/object_hash.sql sql/functions/object_read_write.sql sql/functions/ref_manage.sql sql/functions/tree_parse.sql sql/schema.sql sql/views/queryable.sql test/commit_parse_test.rb test/object_hash_test.rb test/object_store_test.rb test/ref_test.rb test/roundtrip_test.rb test/schema_test.rb test/test_helper.rb test/tree_parse_test.rb nothing added to commit but untracked files present (use "git add" to track)
git -C /Users/andrew/code/gitgres add .gitignore README.md Makefile backend/Makefile backend/main.c backend/odb_postgres.c backend/odb_postgres.h backend/refdb_postgres.c backend/refdb_postgres.h backend/writepack_postgres.c ext/Makefile ext/git_oid_type.c ext/gitgres.c ext/gitgres.control ext/sha1_hash.c ext/sql/gitgres--0.1.sql ext/tree_parse.c import/gitgres-import.sh sql/schema.sql sql/functions/object_hash.sql sql/functions/object_read_write.sql sql/functions/tree_parse.sql sql/functions/commit_parse.sql sql/functions/ref_manage.sql sql/views/queryable.sql test/test_helper.rb test/schema_test.rb test/object_hash_test.rb test/object_store_test.rb test/tree_parse_test.rb test/commit_parse_test.rb test/ref_test.rb test/roundtrip_test.rb(empty result)