git-ai icon indicating copy to clipboard operation
git-ai copied to clipboard

Test Failures in `rust:slim-bookworm` (Debian 12) Due to Git Version Incompatibility

Open AtnesNess opened this issue 2 months ago • 0 comments

Environment

  • Docker Image: rust:slim-bookworm
  • OS: Debian 12 (Bookworm)
  • Git Version: 2.39.5
  • Rust Version: 1.90.0

Issue Description

Four tests fail when running cargo test in the rust:slim-bookworm Docker image due to Git version incompatibility. The tests attempt to use the --merge-base option with git merge-tree --write-tree, which is not supported in Git 2.39.5.

Failed Tests

  1. authorship::rebase_authorship::tests::test_prepare_working_log_simple_squash
  2. authorship::rebase_authorship::tests::test_prepare_working_log_squash_multiple_files
  3. authorship::rebase_authorship::tests::test_prepare_working_log_squash_multiple_sessions
  4. authorship::rebase_authorship::tests::test_prepare_working_log_squash_with_main_changes

Error Message

error: unknown option `merge-base=<sha>'
usage: git merge-tree [--write-tree] [<options>] <branch1> <branch2>
   or: git merge-tree [--trivial-merge] <base-tree> <branch1> <branch2>

Command Being Executed

git merge-tree --write-tree --merge-base=<commit-sha> -X ours <branch1> <branch2>

Root Cause

The --merge-base option for git merge-tree --write-tree was introduced in Git 2.46.0 (or a version between 2.39.5 and 2.47.0). Debian 12 (Bookworm) ships with Git 2.39.5, which doesn't support this option.

Test Results

Docker Image Debian Version Git Version Test Result
rust:latest Trixie (13) 2.47.3 ✅ All tests pass
rust:slim-bookworm Bookworm (12) 2.39.5 ❌ 4 tests fail

Reproduction Steps

docker run --rm -v $(pwd):/workspace -w /workspace rust:slim-bookworm bash -c "
  apt-get update && apt-get install -y libssl-dev pkg-config git &&
  cargo test -- --test-threads=1
"

Possible Solutions

  1. Update minimum Git version requirement to 2.46.0+ in documentation
  2. Add fallback logic for older Git versions that don't support --merge-base
  3. Use alternative Git commands that are compatible with Git 2.39.5
  4. Update CI/CD to use a Docker image with Git 2.46.0+

Related Code

The failures occur in src/authorship/rebase_authorship.rs where git merge-tree is invoked with the --merge-base option for handling squash merge scenarios.

Impact

  • Users running on Debian 12 (Bookworm) stable will experience test failures
  • CI/CD pipelines using rust:slim-bookworm will fail
  • Affects production environments using Debian 12 if these code paths are executed

AtnesNess avatar Oct 29 '25 00:10 AtnesNess