Commit graph

19 commits

Author SHA1 Message Date
Pat Zielinski
07c87fa656 gitinterface: Add utilities helpful for gittuf hooks
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
Co-authored-by: Jamal Cao <jamaltheodds@gmail.com>
2025-03-06 23:18:09 -05:00
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 A Yelgundhalli
7e55828f7f
*: Add verify-mergeable
This commit enables checking if a change in a feature ref can be merged into
the target ref. Significantly, this API returns true if the policy can be met
when the merge is performed by an authorized person.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-11-21 13:52:22 -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 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
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
140d7e55ad
gitinterface: Add utils funcs
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-06-05 18:24:19 -04:00
Aditya Sirish
e95723d6f5
gitinterface: Add references
Also updates an expected error return in policy.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-05-22 23:39:19 +05:30
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
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
a95ec8df43
*: Fix linter issues
This commit fixes issues flagged by the additional linters enabled in
the parent commit.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-24 16:48:46 -04:00
Aditya Sirish
ef38590f91
*: Drop explicit trackRemote option
Now, the remote tracker is always updated. If gitinterface.Fetch is used
with a refName, it assumes the default is to fetch to the same target in
the local repository. By default, it also updates the remote tracker.
For more granular control, FetchRefSpec must be used.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-11 21:31:28 -04:00
Aditya Sirish
30953507b0
gitinterface: Make remote ref generation reusable
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-11 21:30:35 -04:00
Aditya Sirish
7d59b2643c
gitinterface: Resolve HEAD to target absolute path
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-11 20:52:41 -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
bdf56b6577
gitinterface: Generalize signature functions
This is in preparation for re-use with tags.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-13 12:24:26 -04:00
Aditya Sirish
a6e7ece288
*: Add RefSpec creation capability to gitinterface
Also moves AbsoluteReference from repository to gitinterface.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-12 13:06:53 -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