Skip to content

Conversation

@pjbgf
Copy link
Member

@pjbgf pjbgf commented Aug 9, 2024

A few changes aimed at the v6-exp branch were floating around different branches. This PR consolidates those changes so that those other branches can be deleted.

Changes of note:

pjbgf added 5 commits August 9, 2024 21:07
go-git does not support concurrency. In some cases, read
concurrency may lead to repositories becoming corrupted
or actions to yield invalid results (e.g. not finding an
existing ref).

This commit is an initial attempt to start supporting
read concurrency. Some initial use cases that seem to be
enabled by these changes:

- repository.CommitObjects().Foreach()
- repository.Tags().Foreach()
- commit.IsAncestor()

The mutex objects that were introduced must be expanded
other parts of the code base affected, and some performance
off-setting is planned to take place. Both will be tackled
in follow-up commits.

Signed-off-by: Paulo Gomes <[email protected]>
The implementation of the v2 wire protocol will require that the
protocol can be set and shared amongst different parts of the code
base.

This change introduces the config support for managing protocol.version
but more importantly introduces the Version type in plumbing/protocol.

Signed-off-by: Paulo Gomes <[email protected]>
The BoundOS further aligns go-git with the upstream behaviour, removing
suprises that generally catch go-git users off-guard. For more information
refer to go-billy's docs:
https://github.com/go-git/go-billy/blob/69f6dc8f11964f3aafa2a7a0be6db030ad43ecf4/osfs/os_bound.go#L32-L42

Signed-off-by: Paulo Gomes <[email protected]>
@pjbgf pjbgf requested a review from hiddeco August 12, 2024 08:55
Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor design comments

config/config.go Outdated
Comment on lines 122 to 124
// using the specified protocol version. If the server does not
// support it, communication falls back to version 0. If unset,
// the default is 2. Supported versions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// using the specified protocol version. If the server does not
// support it, communication falls back to version 0. If unset,
// the default is 2. Supported versions:
// using the specified protocol version. If the server does not
// support it, communication falls back to version 0. If unset,
// the default version will be used. Supported versions:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support depends on the implementation of both client and server.

config/config.go Outdated
// should be marshalled or not.
// Note that this does not need to align with the default protocol
// version from plumbing/protocol.
DefaultProtocolVersion = protocol.Unknown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DefaultProtocolVersion = protocol.Unknown
DefaultProtocolVersion = protocol.V0 // go-git only supports V0 for the moment

Comment on lines +126 to +129
// 0 - the original wire protocol.
// 1 - the original wire protocol with the addition of a
// version string in the initial response from the server.
// 2 - Wire protocol version 2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, go-git only supports V0 as of now

type Version int

const (
Unknown Version = -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Unknown Version = -1
Undefined Version = -1

Perhaps Undefined signifies the intention better


// Override http(s) default protocol to use our custom client
client.InstallProtocol("https", githttp.NewClient(customClient))
transport.Register("https", githttp.NewClient(customClient))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:chefkiss:

@pjbgf pjbgf merged commit bec3e03 into go-git:v6-exp Aug 21, 2024
@aymanbagabas
Copy link
Member

@pjbgf Thinking more about protocol.Undefined, maybe that's unnecessary. Is there a way to get rid of that and make it so that it uses the config defined version, or falls back to the DefaultProtocolVersion?

@pjbgf
Copy link
Member Author

pjbgf commented Aug 22, 2024

@aymanbagabas good point. I think we are better positioned to review the mechanics around this during the implementation of newer protocol versions, so we can test it E2E. I am aiming to work on this soonish - just trying to get other minor changes on v6-exp out of the way first.

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.

2 participants