Commit graph

27 commits

Author SHA1 Message Date
Aditya Sirish
79efbf235f
gitinterface: Support types for tree entries
Signed-off-by: Aditya Sirish <aditya@saky.in>
2025-02-02 14:07:34 -05:00
Aditya Sirish
3236696c98
*: Extend TreeBuilder to reuse existing trees
If an intermediate tree already exists and we know this ahead of time,
we should use it without recreating it with all of its contents resolved
and written recursively. This commit adds support for such cases and
renames TreeBuilder's APIs to generalize away from accepting blob IDs
only.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2025-02-02 12:06:18 -05:00
Pat Zielinski
d571facb8d *: Add copyright notice to code files
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-09-27 15:28:12 -04:00
Aditya Sirish
713626bb56
rsl: Add incrementing number to RSL entry
This commit adds a uint64 Number field to RSL entries. This allows us to
determine the ordering of distinct RSL entries, enabling optimizations
such as knowing which policy to use for an entry without always walking
the RSL.

The implementation maintains backwards compatibility, so the numbering
can start from whenever this is enabled. This is made easy by the fact
that we can guarantee gittuf is updated everywhere it is currently used.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-09-23 13:18:21 -04:00
Aditya Sirish A Yelgundhalli
fe6d1d343a
*: Drop old gitinterface APIs
This commit also renames ReplacementTreeBuilder to TreeBuilder.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-07-01 10:21:25 -04:00
Aditya Sirish
bd5baa2e32 *: Use rewritten gitinterface
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-06-21 10:36:16 -04:00
Aditya Sirish
03159de27f
*: Centralize test artifacts
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-15 00:23:47 -05:00
Billy Lynch
d3b0ae454e
Merge pull request #205 from gittuf/export-test-configs
common: Export test config and clock
2023-11-29 10:40:21 -05:00
Aditya Sirish
2fd0988424
dep: Remove vendored copy of go-git
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-11-29 21:04:54 +05:30
Aditya Sirish
464d5339c0
common: Export test config and clock
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-11-25 11:49:49 +05:30
neilnaveen
40ed92a52d Make CreateCommitObject Support Merge Commits
- Make CreateCommitObject support merge commits, with multiple parent
  hashes
- Changed other files to use an array of parent hashes instead of a
  single hash
- By changing the parameters for CreateCommitObject, internal/common had
  errors that had to be fixed.

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2023-11-06 15:55:59 -06:00
Billy Lynch
d57191618a
Remove module replace in favor of a package fork.
This removes the sub-go.mod in favor of updating all references to the
third_party/go-git package.

This lets users `go install` from outside of the module.

Signed-off-by: Billy Lynch <billy@chainguard.dev>
2023-10-25 19:25:56 -04:00
Aditya Sirish
1ec4fb2dde
common: Support creating test annotations
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-19 11:21:41 -04:00
Aditya Sirish
31a59f55f6
*: Pass signing key as parameter to test helpers
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-19 11:20:09 -04:00
Aditya Sirish
20eb599ba2
*: Fix RSL naming and docs
Rename EntryType to Entry for a better generic term. This avoids a
collision with the actual rsl.Entry type. The old Entry type is now
named ReferenceEntry and the Annotation type is AnnotationEntry.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-18 15:25:01 -04:00
Aditya Sirish
a02f931501
*: Store empty tree object by default
Also, update test helper to use empty tree in RSL entries.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-12 11:24:14 -04:00
Pat Zielinski
d0905e7816 Add SPDX License Identifiers to code files
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2023-10-09 08:09:34 -04:00
Aditya Sirish
441d4c473e
*: Support verifying tags
In addition to gittuf verify-tag workflows, this commit fixes the RSL to
be more generic. An RSL entry no longer exclusively requires a commit
ID.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-04 11:22:33 -04:00
Aditya Sirish
106f034933
Merge pull request #113 from gittuf/tags
Add support for tags
2023-09-15 14:34:23 -04:00
Aditya Sirish
10aa865f77
common: Fix test Git config
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-13 13:32:06 -04:00
Aditya Sirish
ab49c0d7de
*: Drop RSL prefix in ref, add helper for tracker
rsl.RSLRef is now just rsl.Ref to avoid the repetition. Also,
RSLRemoteTrackerRef is no longer a constant, replaced by
rsl.RemoteTrackerRef() which returns a substituted tracker string for
the specified remote.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-12 17:29:29 -04:00
Aditya Sirish
29b795abe3
*: Update gitinterface.Commit behavior
1. Commit now returns the ID of the newly created commit. This will help
   us avoid extraneous calls to repo.Reference to get the new state of
   the affected ref.
2. Commit also creates the ref if it doesn't already exist. This allows
   to skip initializing (to zero) refs we're about to commit to anyway.
   Note: this commit does not actually remove those extra
   initializations. That is left to a future patch or clean up pass.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-12 13:06:53 -04:00
Aditya Sirish
258254c8a8
common: Changes to test helpers
* Sign test commits
* Don't set ref to zero unless it's a new ref when creating test commits

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-11 15:34:14 -04:00
Aditya Sirish
3192cdb861
Rename module to use gittuf org
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-30 13:13:54 -04:00
Aditya Sirish
d48a0b8ead
common, gitinterface: Clean up test data
Define test data such as user information, Git config, fake clock once
at most per package.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-18 16:32:21 -04:00
Aditya Sirish
800cfcba4f
common: Add ability to create test commits
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-18 16:08:13 -04:00
Aditya Sirish
6ece1924c2
*: Test repository.VerifyRef
As part of this commit, some test helper code is reorganized to avoid repetition in
repository and policy.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-07-14 10:48:22 -04:00