This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/aitimemachine/git/t/t5408-send-pack-stdin.sh
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

103 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
test_description='send-pack --stdin tests'
. ./test-lib.sh
create_ref () {
tree=$(git write-tree) &&
test_tick &&
commit=$(echo "$1" | git commit-tree $tree) &&
git update-ref "$1" $commit
}
clear_remote () {
rm -rf remote.git &&
git init --bare remote.git
}
verify_push () {
git rev-parse "$1" >expect &&
git --git-dir=remote.git rev-parse "${2:-$1}" >actual &&
test_cmp expect actual
}
test_expect_success 'setup refs' '
cat >refs <<-\EOF &&
refs/heads/A
refs/heads/C
refs/tags/D
refs/heads/B
refs/tags/E
EOF
for i in $(cat refs); do
create_ref $i || return 1
done
'
# sanity check our setup
test_expect_success 'refs on cmdline' '
clear_remote &&
git send-pack remote.git $(cat refs) &&
for i in $(cat refs); do
verify_push $i || return 1
done
'
test_expect_success 'refs over stdin' '
clear_remote &&
git send-pack remote.git --stdin <refs &&
for i in $(cat refs); do
verify_push $i || return 1
done
'
test_expect_success 'stdin lines are full refspecs' '
clear_remote &&
echo "A:other" >input &&
git send-pack remote.git --stdin <input &&
verify_push refs/heads/A refs/heads/other
'
test_expect_success 'stdin mixed with cmdline' '
clear_remote &&
echo A >input &&
git send-pack remote.git --stdin B <input &&
verify_push A &&
verify_push B
'
test_expect_success 'cmdline refs written in order' '
clear_remote &&
test_must_fail git send-pack remote.git A:foo B:foo 2>err &&
test_grep "multiple updates for ref ${SQ}refs/heads/foo${SQ} not allowed" err &&
test_must_fail git --git-dir=remote.git rev-parse foo
'
test_expect_success 'cmdline refs with multiple duplicates' '
clear_remote &&
test_must_fail git send-pack remote.git A:foo B:foo C:foo 2>err &&
test_grep "multiple updates for ref ${SQ}refs/heads/foo${SQ} not allowed" err &&
test_must_fail git --git-dir=remote.git rev-parse foo
'
test_expect_success '--stdin refs come after cmdline' '
clear_remote &&
echo A:foo >input &&
test_must_fail git send-pack remote.git --stdin B:foo <input &&
test_grep "multiple updates for ref ${SQ}refs/heads/foo${SQ} not allowed" err &&
test_must_fail git --git-dir=remote.git rev-parse foo
'
test_expect_success 'refspecs and --mirror do not mix (cmdline)' '
clear_remote &&
test_must_fail git send-pack remote.git --mirror $(cat refs)
'
test_expect_success 'refspecs and --mirror do not mix (stdin)' '
clear_remote &&
test_must_fail git send-pack remote.git --mirror --stdin <refs
'
test_done