Skip to content

Merge v6-transport, fix upload-requests atomic logic, and update tests #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

aymanbagabas
Copy link

No description provided.

onee-only and others added 30 commits April 28, 2025 11:39
this commit removes InitWithOptions by collapsing it back into
Init(storage, opt...)

NOTE: this is a breaking change for the syntax of calling
      Init as the type of the second option has changed
      and instead of calling Init(storage, worktree) we
      now call Init(storage, WithWorkTree(worktree))
…ovements

Minor improvements to transport tests
remove references to NoMatchingRefSpecError, update error value returned
from doCalculateRefs, update remote_test to test against the new error

retain ref info in remote ref not found error, simplify test fetch error check
git: remote, replace NoMatchingRefSpecError with ErrRemoteRefNotFound, Fixes go-git#1480
…tion

Add sparse reset directory validation and remove ResetSparsely.
Co-authored-by: Paulo Gomes <[email protected]>
Co-authored-by: Copilot <[email protected]>
This small change makes the backend more idiomatic by
removing `BackendOptions` and making `Backend` implement
the [http.Handler] interface directly. The loader is now
part of the `Backend` struct.
…status-tests

[V6] Add some report-status and send-pack tests
[v6] backend: http, make backend more idiomatic
…ions

repository: adopt variadic options pattern for Init and PlainInit
The support for SHA256 will require the mapping between ObjectFormat and the
correct hash.Hash to be used.

Signed-off-by: Paulo Gomes <[email protected]>
The introduction of both new types are a stepping stone to enable
SHA256 support concurrently - without the need for a build tag.

ImmutableHash provides a way to represent varied sized hashes (for SHA1
or SHA256) with a single type, while keeping similar performance of the
existing plumbing.Hash.

The names were picked in order to provide a clearer distinction on what
they do. ImmutableHash is the result of a hash operation and can't be
changed once calculated. ObjectHasher, adds the Git object header before
a normal hash operation that hash.Hash or plumbing/hash.Hash do.

The performance results shows that SHA1 operations could be slower,
however for SHA256 it can be over 3 times faster:

~Hasher/hasher-sha1-100B-16         	            2202226	     574.7 ns/op	 174.00 MB/s     272 B/op     7 allocs/op
~Hasher/objecthash-sha1-100B-16     	            1511851	     772.6 ns/op	 129.43 MB/s     272 B/op     9 allocs/op
~Hasher/objecthash-sha256-100B-16   	            5057584	     247.4 ns/op	 404.21 MB/s      96 B/op     7 allocs/op
~Hasher/hasher-sha1-5000B-16        	              96476	     12523 ns/op	 399.25 MB/s    5536 B/op     7 allocs/op
~Hasher/objecthash-sha1-5000B-16    	             105376	     10983 ns/op	 455.27 MB/s     272 B/op     9 allocs/op
~Hasher/objecthash-sha256-5000B-16  	             420741	      2828 ns/op	1767.77 MB/s      96 B/op     7 allocs/op
~HashFromHex/hasher-parse-sha1-valid-16         	23243548     64.65 ns/op	 618.69 MB/s      48 B/op     1 allocs/op
~HashFromHex/objecthash-fromhex-sha1-valid-16   	18120699     79.62 ns/op	 502.36 MB/s      72 B/op     2 allocs/op
~HashFromHex/objecthash-fromhex-sha256-valid-16 	 8969871    124.2 ns/op	     515.22 MB/s      96 B/op     2 allocs/op

Signed-off-by: Paulo Gomes <[email protected]>
pjbgf and others added 27 commits June 3, 2025 23:56
Signed-off-by: Paulo Gomes <[email protected]>
ObjectID differs from the previous Hash as it has a new
format field. For the purposes for equality checking, both
values 'sha1' and '' should be perceived as the same, so
to avoid cases where the equality check is not being done
internally, the value 'sha1' is no longer used. The field
format should only be populated when its value is 'sha256'.

Signed-off-by: Paulo Gomes <[email protected]>
This commit changes the ObjectFormat type from a string to an int. This
would make a default ObjectFormat declaration default to SHA1. A string
function is defined to return the string representation of the ObjectFormat.
This combines the ObjectHasher implementation to be hash function
agnostic. The SHA1 and SHA256 implementations are now combined into a
single implementation that uses the given format to determine the
hash function to use.
Users can opt-out of sha1cd by adding an empty import
for the upstream implementation:
_ "crypto/sha1"

Signed-off-by: Paulo Gomes <[email protected]>
*: Initial support for opening sha256 repositories using `ObjectID`
)

* plumbing: Introduce a first-parent git log traversal option
…tree

Co-authored-by: Anshul Khandelwal <[email protected]>
Co-authored-by: Daan Schoone <[email protected]>
Signed-off-by: Paulo Gomes <[email protected]>
Signed-off-by: Paulo Gomes <[email protected]>
[v6-transport] Remove go-git-fixtures@v4 dependency.
@aymanbagabas aymanbagabas force-pushed the v6-transport-fix-tests branch from 4f6c4b0 to 585d900 Compare June 10, 2025 18:21
@onee-only onee-only merged commit 3fe598a into onee-only:v6-transport-expose-test Jun 10, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants