Commit graph

27 commits

Author SHA1 Message Date
Aditya Sirish A Yelgundhalli
23b3282539
gitinterface: Add subtree workflow
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-04 16:48:38 -05:00
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
Aditya Sirish A Yelgundhalli
464c50d552
gitinterface: Add APIs for inspecting trees
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-01-31 13:14:35 -05:00
Aditya Sirish A Yelgundhalli
87f2f96b40
gitinterface: Support ff merge in GetMergeTree
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-29 22:37:29 -04: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 A Yelgundhalli
e9514f31bb
*: Add GetMergeTree tests
Also addresses some required changes to tests hitting GetMergeTree via older
Git versions. This is because we use checkout to compute merge tree in those
cases, and we need to ensure that in the test, the worktree modified is that of
the temporary repository rather than the gittuf repository itself.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
Co-authored-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-08-08 13:37:12 -04:00
Pat Zielinski
0d4cfa3ea2 gitinterface: Add workaround for legacy merge-tree command
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-08-07 12:45:17 -04:00
Aditya Sirish A Yelgundhalli
baae9ae1c9
gitinterface: Use trivial merge flow for merge-tree
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-07-18 17:29:21 -04:00
Aditya Sirish A Yelgundhalli
f6ca551b96
gitinterface: Drop use of --format in git ls-tree
This allows us to support Git < 2.36, needed for users still on Ubuntu 22.04.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-07-18 16:55:23 -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 A Yelgundhalli
e871053716 gitinterface: Fixes for executor
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-13 11:42:27 -04:00
Aditya Sirish A Yelgundhalli
d1ecf8fb70 gitinterface: Clean up repository.execute methods
This commit applies @wlynch's feedback from https://github.com/gittuf/gittuf/pull/383#discussion_r1628088633.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-11 16:46:22 -04:00
Aditya Sirish
cd8dcc4a3f
gitinterface: Add support for trees
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-05-22 23:39:19 +05:30
Aditya Sirish
d4ee65ce67
gitinterface: Handle zero commit in GetMergeTree
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-04-15 13:10:25 -04:00
Aditya Sirish
4d2fed23e2
*: Switch authorizations to use merge tree target
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-04-10 15:21:34 -04:00
Aditya Sirish
a2671464de
gitinterface: Support empty trees in TreeBuilder
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-03 11:11:03 -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
10d8330126
gitinterface: Get all blob paths and IDs in tree
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-11-21 16:49:01 +05:30
Aditya Sirish
1d724fb749
gitinterface: Fix var names
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-11-02 16:05:36 -04:00
Billy Lynch
454e21c65d
Merge pull request #157 from gittuf/get-objects-from-gitinterface
*: Route GetObject requests through gitinterface
2023-11-02 14:50:42 -04:00
Aditya Sirish
2e89a841dd
gitinterface: Add TreeBuilder
TreeBuilder allows for adding multiple files (with their blob IDs) to a
tree, creating intermediate trees on the fly based on the files' paths.

This is based significantly off "buildTreeHelper" in go-git. It's
possible this will eventually be upstreamed to go-git in plumbing and
used in "buildTreeHelper".

cc @pjbgf

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-11-01 12:15:28 -04:00
Aditya Sirish
0541411fc1
*: Route GetObject requests through gitinterface
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>
2023-10-26 11:13:32 -04: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
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
ce0ddf8b5b
rsl, gitinterface: Use empty tree
Currently, we're using a zerohash for the tree ID for RSL entries. This
is flagged as an error by Git, and visible when trying to push to some
forges.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-07-12 18:01:04 -04:00
Aditya Sirish
9195a70ba7
Several changes to prepare policy namespace
This commit includes several plumbing changes.
* Support for trees and blobs in gitinterface
* Initialization of refs/gittuf independent of policy / RSL packages
* Initialization of policy and policy-staging namespaces
* rsl.InitializeNamespace is now only responsible for its own namespace
* Replaces some t.Error calls with t.Fatal

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-03-21 12:46:09 -04:00