-
Notifications
You must be signed in to change notification settings - Fork 811
Open
Description
There's not a lot of overlap between the code for fetching and the code for pushing. As a newcomer, I think the code would be easier to understand if these two aspects of a remote were each in their own separate file. By my reckoning, based on the v6-transfer
branch (including a couple of my proposed changes), the separation would look something like this:
remote.go
:
var NoErrAlreadyUpToDate
var ErrEmptyUrls
type Remote
func NewRemote()
func (r *Remote) IsAnonymous()
func (r *Remote) Config()
func (r *Remote) String()
func newClient()
func isFastForward()
func buildSidebandIfSupported()
(not actually used)func (r *Remote) ListContext()
func (r *Remote) List()
func (r *Remote) list()
remote_fetch.go
:
var ErrForceNeeded
var ErrExactSHA1NotSupported
type NoMatchingRefSpecError
func (e NoMatchingRefSpecError) Error()
func (e NoMatchingRefSpecError) Is()
const maxHavesToVisitPerRef
const peeledSuffix
func (r *Remote) FetchContext()
func (r *Remote) Fetch()
func (r *Remote) fetch()
func referenceStorageFromRefs()
func depthChanged())
func (r *Remote) pruneRemotes()
func getRemoteRefsFromStorer()
func getHavesFromRef()
func getHaves()
const refspecAllTags
func calculateRefs()
func doCalculateRefs()
func getWants()
func objectExists()
func (r *Remote) isSupportedRefSpec()
func (r *Remote) updateLocalReferenceStorage()
func (r *Remote) buildFetchedTags()
remote_push.go
:
var ErrDeleteRefNotSupported
func (r *Remote) Push()
func (r *Remote) PushContext()
func (r *Remote) sendPack()
func (r *Remote) useRefDeltas()
func (r *Remote) addReachableTags()
func (r *Remote) updateRemoteReferenceStorage()
func (r *Remote) addReferencesToUpdate()
func (r *Remote) addOrUpdateReferences()
func (r *Remote) deleteReferences()
func (r *Remote) addObject()
func (r *Remote) addReferenceIfRefSpecMatches()
func checkFastForwardUpdate()
func (r *Remote) checkForceWithLease()
func objectsToPush()
func referencesToHashes()
func pushHashes()
func (r *Remote) checkRequireRemoteRefs()
Similarly, remote_test.go
could spawn new files remote_fetch_test.go
and remote_push_test.go
.
I'm not going to create a PR for this now, because the conflicts with any in-progress pull requests would be fierce. But maybe when this part of the code is in a more quiescent state, such a division would be worth considering.