gitgram/aitimemachine/git/t/helper/test-find-pack.c
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

54 lines
1.2 KiB
C

#define USE_THE_REPOSITORY_VARIABLE
#include "test-tool.h"
#include "object-name.h"
#include "odb.h"
#include "packfile.h"
#include "parse-options.h"
#include "setup.h"
/*
* Display the path(s), one per line, of the packfile(s) containing
* the given object.
*
* If '--check-count <n>' is passed, then error out if the number of
* packfiles containing the object is not <n>.
*/
static const char *const find_pack_usage[] = {
"test-tool find-pack [--check-count <n>] <object>",
NULL
};
int cmd__find_pack(int argc, const char **argv)
{
struct object_id oid;
struct packed_git *p;
int count = -1, actual_count = 0;
const char *prefix = setup_git_directory();
struct option options[] = {
OPT_INTEGER('c', "check-count", &count, "expected number of packs"),
OPT_END(),
};
argc = parse_options(argc, argv, prefix, options, find_pack_usage, 0);
if (argc != 1)
usage(find_pack_usage[0]);
if (repo_get_oid(the_repository, argv[0], &oid))
die("cannot parse %s as an object name", argv[0]);
repo_for_each_pack(the_repository, p) {
if (find_pack_entry_one(&oid, p)) {
printf("%s\n", p->pack_name);
actual_count++;
}
}
if (count > -1 && count != actual_count)
die("bad packfile count %d instead of %d", actual_count, count);
return 0;
}