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>
This commit adds ReconcileLocalRSLWithRemote, which checks the local RSL
against the specified remote and reconciles the local RSL if needed. If
the local RSL doesn't exist or is strictly behind the remote RSL, then
the local RSL is updated to match the remote RSL. If the local RSL is
ahead of the remote RSL, nothing is updated. Finally, if the local and
remote RSLs have diverged, then the local only RSL entries are reapplied
over the latest entries in the remote if the local only RSL entries and
remote only entries are for different Git references.
Signed-off-by: Aditya Sirish <aditya@saky.in>
Also updates error chaining in signature verification to preserve error
context, making debugging easier.
Signed-off-by: Aditya Sirish <aditya@saky.in>
- 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>
This allows us to perform additional checks in future such as whether an
object is replaced by a replace ref. It also makes it easier to switch
between go-git and another mechanism to invoke Git, such as directly
using the binary.
Signed-off-by: Aditya Sirish <aditya@saky.in>
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>
This fixes a previously unnoticed bug in setting the test config where
the user's name and email were actually left blank. This is an issue
with how go-git parses the raw parts of the config vs the defined
structs. This was primarily noticed because of mismatched hashes on
GitHub actions in the tag, the expected values have changed in some
existing tests as well.
Signed-off-by: Aditya Sirish <aditya@saky.in>
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>
* Add functions to track changes introduced by commits or between commits
* Add function to check if a commit knows another using reachability
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit introduces early, experimental support for gitsign
signatures on git commits. It uses TAP-18 to specify sigstore identity
constraints in delegations.
The feature introduced here depends on unreleased prototype code in
go-securesystemslib and is also insufficiently tested due to some
sigstore library constraints.
See: #73
Signed-off-by: Aditya Sirish <aditya@saky.in>
This package includes a set of helpers to interface with the underlying
git repository. Features:
* parse git configs to determine commit signing mechanism
* create and sign commit objects
Signed-off-by: Aditya Sirish <aditya@saky.in>