-
Notifications
You must be signed in to change notification settings - Fork 534
config: support a configurable, and turn-off-able, pack.window #587
config: support a configurable, and turn-off-able, pack.window #587
Conversation
Is this a feature in the standard git tooling? |
Yes: https://stackoverflow.com/questions/7102053/git-pull-without-remotely-compressing-objects |
Thanks for your contribution, make a lot of sense for people using memory based storage or others. I cannot see a config flag exactly for this feature, the core.compression flag in stackoverflow, has a different behavior. As you can see in the document this kind of configuration it's done at config level. So instead of having it as a flag of the If this property doesn't exists on the standard git, I am open to merge this PR with a flag call |
It looks like this is controlled via a gitattributes option on specific file glob patterns. Ideally we would control this behavior via the same gitattributes, but I don't believe that currently the go-git library supports gitattributes. The are a bunch of other behaviors that can be controlled via gitattributes as well. |
This is handle by the Lines 35 to 42 in bb3217c
|
Thanks for taking a look guys. I don't think this is really equivalent to a core config param. It's more equivalent to setting I'm not sure why |
Yes, I think this is the best solution, since implementing this as |
032196f
to
db279de
Compare
Codecov Report
@@ Coverage Diff @@
## master #587 +/- ##
==========================================
- Coverage 78.32% 77.72% -0.61%
==========================================
Files 130 130
Lines 10092 10122 +30
==========================================
- Hits 7905 7867 -38
- Misses 1342 1418 +76
+ Partials 845 837 -8
Continue to review full report at Codecov.
|
Thanks @mcuadros, done. Please take another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! Just one small comment and ready to merge.
otp, err := dw.objectsToPack(hashes) | ||
func (dw *deltaSelector) ObjectsToPack( | ||
hashes []plumbing.Hash, | ||
packWindow uint, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the comment about this new argument.
plumbing/format/packfile/encoder.go
Outdated
objects, err := e.selector.ObjectsToPack(hashes) | ||
func (e *Encoder) Encode( | ||
hashes []plumbing.Hash, | ||
packWindow uint, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
lgtm once the requests by @mcuadros are added |
Looks great. Probably a nitpick, but could you also please double-check if 0d74736 is intended to be part of these changes? |
One use of go-git is to transfer git data from a non-standard git repo (not stored in a file system, for example) to a "remote" backed by a standard, local .git repo. In this scenario, delta compression is not needed to reduce transfer time over the "network", because there is no network. The underlying storage layer has already taken care of the data tranfer, and sending the objects to local .git storage doesn't require compression. So this PR gives the user the option to turn off compression when it isn't needed. Of course, this results in a larger, uncompressed local .git repo, but the user can then run git gc or git repack on that repo if they care about the storage costs. Turning the pack window to 0 on reduces total push time of a 36K repo by 50 seconds (out of a pre-PR total of 3m26s).
a1681c8
to
52c1f98
Compare
Added comments and rebased it correctly. Thanks all! |
One use of go-git is to transfer git data from a non-standard git repo (not stored in a file system, for example) to a "remote" backed by a standard, local .git repo.
In this scenario, delta compression is not needed to reduce transfer time over the "network", because there is no network. The underlying storage layer has already taken care of the data tranfer, and sending the objects to local .git storage doesn't require compression. So this PR gives the user the option to turn off compression when it isn't needed.
Of course, this results in a larger, uncompressed local .git repo, but the user can then run
git gc
orgit repack
on that repo if they care about the storage costs.Turning the pack window to 0 reduces total push time of a 36K repo by 50 seconds (out of a pre-PR total of 3m26s).