Bisect exports commits with git archive, which omits export-ignore paths

Open
#194 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
69/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, go
Domain
cli, testing

Research direction

Read internal/gitx/gitx.go around Archive and ExportIndex/writeBlobs, then inspect the sole caller and existing error handling in internal/engine/debug.go. Start by tracing how commit trees and blobs are exported and how untar applies file rules. Add coverage for both acceptance criteria: an export-ignore directory remains present and an export-subst file retains its committed bytes; run make test-short.

Written by the indexing model from the issue text.

Description

bug severity: low

Summary

The bisect probe of spackle debug --good exports each commit with git archive, which applies the export-ignore and export-subst attributes, so the probe can run against a tree that is missing committed files.

Where

  • internal/gitx/gitx.go:754-761 (Archive; the comment says the export holds the bytes that were committed)
  • internal/engine/debug.go:652, :664 (the only caller, and the "test does not exist" message)

Details

git archive leaves out paths marked export-ignore in the archived tree's .gitattributes and rewrites $Format:...$ placeholders in export-subst files. Nothing in the repository mentions either attribute. The git behavior is documented in gitattributes(5); not run during the audit, since it needs a model and a container runtime.

Impact

For a repository whose .gitattributes marks its tests or fixtures export-ignore (common in packages that ship archives), every bisect probe runs on a tree without those files. With --test, the first probe ends with "the test ... does not exist at commit HEAD" although the test is committed. With --issue, the reproduction runs against an incomplete tree and can label commits wrongly. The working-tree reproduction that precedes bisect is not affected, so the two disagree.

Steps to reproduce

  1. In a repository with tests/ export-ignore in .gitattributes and a failing test under tests/, run spackle debug --test <name> --good <older-rev> .
  2. The working-tree reproduction succeeds, then bisect reports that the test does not exist at HEAD.

Suggested fix

Export the tree without archive attributes: list it with git ls-tree -r -z <rev> and read the blobs with git cat-file --batch, as ExportIndex / writeBlobs already do for the index (the helpers can be shared), keeping the regular-file-only and size rules of untar.

Acceptance criteria

  • A test exports a commit whose .gitattributes marks a directory export-ignore and finds the directory in the export
  • An export-subst file is exported byte for byte

Related: #84, #41

Getting started

  • Relevant files: internal/engine/debug.go, internal/gitx/gitx.go
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: M. audit-key: bug|internal/gitx/gitx.go|Archive-export-ignore

Dominant language
Go
Stars
0
Forks
1
Avg merge
8h 14m
Merged PRs (30d)
3

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TMHSDigital/Spackle

All issues in TMHSDigital/Spackle

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.