Commit graph

4 commits

Author SHA1 Message Date
Paulo Gomes
5f5f5508e3
feat(sha256): support SHA-256 object format
Make gittuf hash-algorithm aware so it operates on SHA-256 repositories:

- gitinterface.Repository detects its object format (via
  `git rev-parse --show-object-format`) and exposes GetObjectFormat and a
  per-repo ZeroHash. GetReference returns the format-appropriate zero hash
  so ref updates to new refs succeed in SHA-256 repositories.
- Commit and tag signing/verification use the `gpgsig-sha256` header for
  SHA-256 objects (go-git's SignatureSHA256), matching Git's behavior. The
  verification field is chosen by the object's OID length. Fixes verify-ref
  failing on Git-signed SHA-256 RSL entries.
- git-remote-gittuf negotiates object-format from the repository instead of
  hardcoding sha1, and uses the repo-appropriate zero hash for ref tips.
- Test helpers can create SHA-256 repositories; gitinterface, rsl, policy,
  and experimental/gittuf suites now run under both formats, plus an
  end-to-end Git-signed record+verify test.

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
2026-07-16 23:03:18 +01:00
Pat Zielinski
ee20d8f008
pkg: Increase testing coverage
Signed-off-by: Pat Zielinski <git@patzielinski.com>
2026-06-11 12:16:43 -04:00
dawgdevv
8374150f3f test: improve pkg/gitinterface coverage from 69.4% to 76.2%
This PR adds focused tests for error paths and edge cases across
pkg/gitinterface, raising coverage from 69.4% to 76.2%.
Files changed:
- references_test.go: TestAbsoluteReference with branch/tag/custom/ref lookups
- tag_test.go: TestEnsureIsTag, error paths for GetTagTarget and verifyTagSignature
- commit_test.go: TestEnsureIsCommit, error paths for commit inspection helpers
- object_test.go: Error paths for GetObjectType and GetObjectSize
- blob_test.go: Error path for ReadBlob with non-blob object
- status_test.go: Tests for Status errors and StatusCode helpers
- sync_test.go: Tests for WithFetchDepth, CreateRemote, push/fetch errors
- config_test.go: Error path for SetGitConfig
- utils_test.go: TestResetDueToError
Closes #1244

Signed-off-by: dawgdevv <nraj02415@gmail.com>
2026-04-25 02:44:19 +05:30
Pat Zielinski
f649b141d3
pkg: Move gitinterface to pkg
Signed-off-by: Pat Zielinski <git@patzielinski.com>
2026-01-16 14:03:36 -05:00
Renamed from internal/gitinterface/sync_test.go (Browse further)