Skip to content

Clone only most recent commits #49

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions storages/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ func (storageSession *storageSession) clone(params *RequestMetadataParams) error
URL: params.Repository,
Auth: auth,
ReferenceName: ref(params.Ref, false),
// We only need to know the latest version of branches to be able to commit on top
// of them. And, we don't otherwise use the history of the repository. So, this
// saves a lot data.
// A further improvement that has not been implemented would be to use
// sparse-checkouts to only retrieve only blobs (i.e., files) from the server that
// we actually care about. The depth here prevents performance problems from
// history growth. sparse-checkouts help with horizontal growth (e.g., additional
// systems managed by the repository).
Depth: 1,
}

repository, err := git.Clone(storageSession.storer, storageSession.fs, cloneOptions)
Expand Down