diff options
author | Taru Karttunen <taruti@taruti.net> | 2017-11-01 21:06:37 +0200 |
---|---|---|
committer | Jeremy Stribling <strib@alum.mit.edu> | 2017-11-29 10:40:46 -0800 |
commit | ac1914eac3c20efa63de8809229994364ad9639b (patch) | |
tree | 4595bfceec10aea603517e5dc7f493b93e068d30 /storage/filesystem/object.go | |
parent | a6202cacd12aa5ee20c54aff799b0e91330526c5 (diff) | |
download | go-git-ac1914eac3c20efa63de8809229994364ad9639b.tar.gz |
First pass of prune design
Diffstat (limited to 'storage/filesystem/object.go')
-rw-r--r-- | storage/filesystem/object.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go index 9690c0e..9b2790f 100644 --- a/storage/filesystem/object.go +++ b/storage/filesystem/object.go @@ -3,6 +3,7 @@ package filesystem import ( "io" "os" + "time" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/cache" @@ -479,3 +480,26 @@ func hashListAsMap(l []plumbing.Hash) map[plumbing.Hash]bool { return m } + +func (s *ObjectStorage) ForEachObjectHash(fun func(plumbing.Hash) error) error { + err := s.dir.ForEachObjectHash(fun) + if err != nil { + if err == storer.ErrStop { + return nil + } + return err + } + return nil +} + +func (s *ObjectStorage) LooseObjectTime(hash plumbing.Hash) (time.Time, error) { + fi, err := s.dir.ObjectStat(hash) + if err != nil { + return time.Time{}, err + } + return fi.ModTime(), nil +} + +func (s *ObjectStorage) DeleteLooseObject(hash plumbing.Hash) error { + return s.dir.ObjectDelete(hash) +} |