Repository navigation
chore/more fixes #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore/more fixes #171
Changes from all commits
ddf159a
53d7672
25841d0
640acf3
79371f8
4a6be16
063664d
7ef7de2
e1d71b5
c8a6659
4acd312
87b7570
c5451e5
8d3ed7c
68fc826
7e8d026
258c9f0
a8cc1bc
7195186
aad1e87
f495f71
88669fa
97f31b1
d0fec83
2b7feb4
0a19c87
240ce22
5ccf516
b3092ae
9a48c5e
4b8b177
16f0994
8494a8b
b45ca6a
51a6c1c
7a7e6b9
82138b1
22d3f07
dd6ee0f
bbfaafe
ac599f8
395c89f
dcb68c9
a8cdae3
9157271
dc817f5
99f4a3c
2784651
27a9a58
4c424de
f77795e
bc31728
7a7557c
91b6171
73db6ce
6c8a6c3
d31cbe3
1a4a7d2
b776c91
11c1de1
8107afc
1336087
5efa2d0
dc66533
eb6593e
542d2ac
11cd1ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +0,0 @@ | ||
| docs-only: | ||
| - changed-files: | ||
| - any-glob-to-any-file: ['docs/**', 'README.md', 'AGENTS.md', 'CONTRIBUTING.md'] | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |||||||||||||||
|
|
||||||||||||||||
| #include "../include/gitmind.h" | ||||||||||||||||
| #include "gitmind/adapters/fs/posix_temp_adapter.h" | ||||||||||||||||
| #include "gitmind/adapters/git/libgit2_repository_port.h" | ||||||||||||||||
| #include "gitmind/result.h" | ||||||||||||||||
|
|
||||||||||||||||
| #define WILDEBEEST_COUNT 100000 /* Start with 100K edges */ | ||||||||||||||||
|
|
@@ -59,9 +60,9 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
| printf("Creating wildebeest edges...\n"); | ||||||||||||||||
| gm_edge_t *herd = malloc(wildebeest_count * sizeof(gm_edge_t)); | ||||||||||||||||
|
|
||||||||||||||||
| /* Mufasa's SHA (he's at the center of it all) */ | ||||||||||||||||
| uint8_t mufasa_sha[GM_SHA1_SIZE]; | ||||||||||||||||
| generate_wildebeest_sha(mufasa_sha); | ||||||||||||||||
| /* Mufasa's identity (he's at the center of it all) */ | ||||||||||||||||
| gm_oid_t mufasa_oid = {0}; | ||||||||||||||||
| generate_wildebeest_sha(mufasa_oid.id); | ||||||||||||||||
|
|
||||||||||||||||
| /* Generate the herd */ | ||||||||||||||||
| for (int i = 0; i < wildebeest_count; i++) { | ||||||||||||||||
|
|
@@ -70,9 +71,9 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
| /* Half run TO Mufasa, half run FROM */ | ||||||||||||||||
| if (i % 2 == 0) { | ||||||||||||||||
| generate_wildebeest_sha(beast->src_sha); | ||||||||||||||||
| memcpy(beast->tgt_sha, mufasa_sha, GM_SHA1_SIZE); | ||||||||||||||||
| memcpy(beast->tgt_sha, mufasa_oid.id, GM_SHA1_SIZE); | ||||||||||||||||
| } else { | ||||||||||||||||
| memcpy(beast->src_sha, mufasa_sha, GM_SHA1_SIZE); | ||||||||||||||||
| memcpy(beast->src_sha, mufasa_oid.id, GM_SHA1_SIZE); | ||||||||||||||||
| generate_wildebeest_sha(beast->tgt_sha); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -85,8 +86,15 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
|
|
||||||||||||||||
| /* Add to journal */ | ||||||||||||||||
| printf("Releasing the herd into the journal...\n"); | ||||||||||||||||
| gm_context_t ctx = {0}; | ||||||||||||||||
| ctx.git_repo = repo; | ||||||||||||||||
| gm_context_t ctx = (gm_context_t){0}; | ||||||||||||||||
|
|
||||||||||||||||
| gm_result_void_t repo_port_result = | ||||||||||||||||
| gm_libgit2_repository_port_create(&ctx.git_repo_port, NULL, | ||||||||||||||||
| &ctx.git_repo_port_dispose, repo); | ||||||||||||||||
| if (!repo_port_result.ok) { | ||||||||||||||||
| fprintf(stderr, "failed to create git repository port\n"); | ||||||||||||||||
| exit(EXIT_FAILURE); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| gm_result_void_t fs_result = | ||||||||||||||||
| gm_posix_fs_temp_port_create(&ctx.fs_temp_port, NULL, | ||||||||||||||||
|
|
@@ -108,7 +116,7 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
| clock_t start = clock(); | ||||||||||||||||
|
|
||||||||||||||||
| gm_cache_result_t scan_result = {0}; | ||||||||||||||||
| gm_cache_query_fanout(repo, branch, mufasa_sha, &scan_result); | ||||||||||||||||
| gm_cache_query_fanout(&ctx, branch, &mufasa_oid, &scan_result); | ||||||||||||||||
|
|
||||||||||||||||
| clock_t end = clock(); | ||||||||||||||||
| result->journal_scan_ms = ((double)(end - start) / CLOCKS_PER_SEC) * 1000; | ||||||||||||||||
|
|
@@ -127,7 +135,7 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
| start = clock(); | ||||||||||||||||
|
|
||||||||||||||||
| gm_cache_result_t cache_result = {0}; | ||||||||||||||||
| gm_cache_query_fanout(repo, branch, mufasa_sha, &cache_result); | ||||||||||||||||
| gm_cache_query_fanout(&ctx, branch, &mufasa_oid, &cache_result); | ||||||||||||||||
|
|
||||||||||||||||
| end = clock(); | ||||||||||||||||
| result->cache_query_ms = ((double)(end - start) / CLOCKS_PER_SEC) * 1000; | ||||||||||||||||
|
|
@@ -143,6 +151,10 @@ static void run_stampede(git_repository *repo, const char *branch, | |||||||||||||||
| if (ctx.fs_temp_port_dispose != NULL) { | ||||||||||||||||
| ctx.fs_temp_port_dispose(&ctx.fs_temp_port); | ||||||||||||||||
| } | ||||||||||||||||
| if (ctx.git_repo_port_dispose != NULL) { | ||||||||||||||||
| ctx.git_repo_port_dispose(&ctx.git_repo_port); | ||||||||||||||||
| } | ||||||||||||||||
| git_repository_free(repo); | ||||||||||||||||
|
Comment on lines
+154
to
+157
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't free the shared repo inside
- if (ctx.git_repo_port_dispose != NULL) {
- ctx.git_repo_port_dispose(&ctx.git_repo_port);
- }
- git_repository_free(repo);
+ if (ctx.git_repo_port_dispose != NULL) {
+ ctx.git_repo_port_dispose(&ctx.git_repo_port);
+ }Then call 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| free(herd); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -208,7 +220,6 @@ int main(int argc, char **argv) { | |||||||||||||||
| "🦁\n\n"); | ||||||||||||||||
|
|
||||||||||||||||
| /* Cleanup */ | ||||||||||||||||
| git_repository_free(repo); | ||||||||||||||||
| git_libgit2_shutdown(); | ||||||||||||||||
|
|
||||||||||||||||
| /* Remove temp dir */ | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* SPDX-License-Identifier: LicenseRef-MIND-UCAL-1.0 */ | ||
| /* © 2025 J. Kirby Ross / Neuroglyph Collective */ | ||
|
|
||
| #ifndef GITMIND_ADAPTERS_GIT_LIBGIT2_REPOSITORY_PORT_H | ||
| #define GITMIND_ADAPTERS_GIT_LIBGIT2_REPOSITORY_PORT_H | ||
|
|
||
| #include "gitmind/ports/git_repository_port.h" | ||
| #include "gitmind/result.h" | ||
|
|
||
| #include <git2/types.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| typedef struct gm_libgit2_repository_port_state | ||
| gm_libgit2_repository_port_state_t; | ||
|
|
||
| gm_result_void_t gm_libgit2_repository_port_create( | ||
| gm_git_repository_port_t *out_port, | ||
| gm_libgit2_repository_port_state_t **out_state, | ||
| void (**out_dispose)(gm_git_repository_port_t *), git_repository *repo); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* GITMIND_ADAPTERS_GIT_LIBGIT2_REPOSITORY_PORT_H */ |
Uh oh!
There was an error while loading. Please reload this page.