Commit graph

20 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
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
Pat Zielinski
741efb2c40 gitinterface: log_test nit
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-14 13:37:05 -04:00
Aditya Sirish A Yelgundhalli
e44372fb30 gitinterface: Fix docs, add test for ranges across merged branches
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-14 13:01:43 -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
b561471d87 gitinterface: Add changes tests
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-06 12:24:16 -04:00
Pat Zielinski
adca246743 gitinterface: Add log tests
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-06-06 11:34:21 -04:00
neilnaveen
a1095c6e13 Clarify TODO for GetCommitsBetweenRange
- Clarified TODO for GetCommitsBetweenRange, passing the commit id's in
  reverse order should change the result of the function.

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2023-11-30 11:25:35 -06: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
d626318993 Created test in log.go for merge commits
- Created test with a git tree containing a merge commit
- Added additional edge cases for regular git tree

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2023-11-20 12:08:10 -05: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
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
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
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