Commit graph

22 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 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
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 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
ca0f537879 gitinterface: Add test-only support for merge commits
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-11 16:46:22 -04:00
Aditya Sirish A Yelgundhalli
b0c6bac73b gitinterface: Fixes for tests
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-11 16:46:22 -04:00
Pat Zielinski
5c9403efcf gitinterface: Add remaining sync tests
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-07 10:30:59 -04:00
Pat Zielinski
79deec165f gitinterface: Add (some) sync tests
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-06 16:43:38 -04:00
Pat Zielinski
b561471d87 gitinterface: Add changes tests
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-06 12:24:16 -04: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
neilnaveen
8692f7a684 Handle Merge Commit in GetFilePathsChangedByCommit
- Changed handling of merge commits to check if one of the parent commits
  matches the current commit. If not we return the sorted diffs between
  the current commit and all parent commits.

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2023-11-11 19:23:08 -06:00
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
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
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
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
b850488960
gitinterface: Changes and commit reachability
* 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>
2023-09-11 15:34:14 -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
5bb804a767
gitinterface: Identify changed files
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-18 16:07:45 -04:00