aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2017-11-16 21:00:51 +0200
committerJeremy Stribling <strib@alum.mit.edu>2017-11-29 11:01:40 -0800
commitd96582a6fb7df092c2856f56decd33034fe0ade3 (patch)
treee9e0eacfa4bcea2f6aaa8017744ef51f0892eed8 /plumbing
parentfae438980c3e17cb04f84ce92b99cd3c835e3e18 (diff)
downloadgo-git-d96582a6fb7df092c2856f56decd33034fe0ade3.tar.gz
Make object repacking more configurable
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/storer/object.go5
-rw-r--r--plumbing/storer/object_test.go4
2 files changed, 7 insertions, 2 deletions
diff --git a/plumbing/storer/object.go b/plumbing/storer/object.go
index 29e0090..e5f98d7 100644
--- a/plumbing/storer/object.go
+++ b/plumbing/storer/object.go
@@ -55,8 +55,9 @@ type EncodedObjectStorer interface {
// ObjectPacks returns hashes of object packs if the underlying
// implementation has pack files.
ObjectPacks() ([]plumbing.Hash, error)
- // DeleteObjectPackAndIndex deletes an object pack and the corresponding index file if they exist.
- DeleteObjectPackAndIndex(plumbing.Hash) error
+ // DeleteOldObjectPackAndIndex deletes an object pack and the corresponding index file if they exist.
+ // Deletion is only performed if the pack is older than the supplied time (or the time is zero).
+ DeleteOldObjectPackAndIndex(plumbing.Hash, time.Time) error
}
// DeltaObjectStorer is an EncodedObjectStorer that can return delta
diff --git a/plumbing/storer/object_test.go b/plumbing/storer/object_test.go
index 68e8e10..da0db81 100644
--- a/plumbing/storer/object_test.go
+++ b/plumbing/storer/object_test.go
@@ -165,3 +165,7 @@ func (o *MockObjectStorage) DeleteLooseObject(plumbing.Hash) error {
func (o *MockObjectStorage) ObjectPacks() ([]plumbing.Hash, error) {
return nil, nil
}
+
+func (o *MockObjectStorage) DeleteOldObjectPackAndIndex(plumbing.Hash, time.Time) error {
+ return plumbing.ErrObjectNotFound
+}