Skip to content

sparse index: support skip-worktree setup required by add --ignore-missing #490

Description

@genedna

Summary

Libra cannot construct or operate on Git's skip-worktree sparse-index state used by upstream t/t3705-add-sparse-checkout.sh test 13. In particular, update-index --force-remove and update-index --skip-worktree are rejected, and sparse-checkout is not implemented. As a result, the target command add --dry-run --ignore-missing sparse_entry is never reached in the upstream-compatible scenario.

This is tracked by libra-testcases as TC-0010 (git add --dry-run --ignore-missing warn on sparse path).

Versions

  • Libra: 0.22.19
  • Git control: 2.55.0.782.g1630431f32
  • Platform: macOS/Darwin, case-insensitive APFS
  • Upstream source: Git commit 1630431f326e15fcde608827b5ff38422528eb59, t/t3705-add-sparse-checkout.sh lines 10-25 and 140-147

Reproduction

set -eu

work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT

"$LIBRA" init -q --initial-branch=main "$work/repo"
cd "$work/repo"

"$LIBRA" update-index --force-remove sparse_entry
printf 'sparse\n' >sparse_entry
"$LIBRA" add sparse_entry
"$LIBRA" update-index --skip-worktree sparse_entry

Actual behavior

$ libra update-index --force-remove sparse_entry
error: unexpected argument '--force-remove' found
Error-Code: LBR-CLI-002
exit=129

$ libra update-index --skip-worktree sparse_entry
error: unexpected argument '--skip-worktree' found
Error-Code: LBR-CLI-002
exit=129

$ libra sparse-checkout init --no-cone
libra: 'sparse-checkout' is not a libra command. See 'libra --help'.
Error-Code: LBR-CLI-001
exit=129

The original full test run stops at update-index --force-remove sparse_entry; it never executes add --dry-run --ignore-missing sparse_entry.

Expected behavior

Git supports the setup:

git update-index --force-remove sparse_entry        # exit 0
git add sparse_entry                                # exit 0
git update-index --skip-worktree sparse_entry       # exit 0
git config core.sparseCheckout false                # exit 0
git commit --allow-empty -m 'ensure sparse_entry exists at HEAD'

After removing the working-tree path, Git runs:

git add --dry-run --ignore-missing sparse_entry

The command exits with a regular non-zero status, leaves the skip-worktree index entry unchanged and unstaged, and reports that the path is outside the sparse-checkout definition with --sparse/sparsity-rule advice.

Acceptance criteria

  1. Support update-index --force-remove and update-index --skip-worktree for the sparse-entry setup, or provide Git-compatible behavior through the mapped CLI surface.
  2. Support the sparse-checkout behavior required for a skip-worktree entry, including the core.sparseCheckout=false scenario used above.
  3. For add --dry-run --ignore-missing on a missing skip-worktree path, return a regular non-zero status, preserve the index entry and staged diff state, and emit a diagnostic identifying the sparse path and remediation.
  4. Product-specific error-code, hint, or JSON formatting is acceptable, but the target command must actually be reached in the upstream scenario.

Test tracking

  • cases/tc0010-add-dry-run-sparse-path/tc0010-add-dry-run-sparse-path.sh
  • libra-git-testcases-spec.md TC-0010
  • results/libra-0.22.19/notes.md TC-0010
  • libra-git-testcases-review.md TC-0010

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtestvcs

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions