File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -513,15 +513,30 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
513513 fn gc_category ( & self , category : & str ) -> Result < HashSet < ObjectID > > {
514514 let mut objects = HashSet :: new ( ) ;
515515
516- let category_fd = self . openat ( category, OFlags :: RDONLY | OFlags :: DIRECTORY ) ?;
516+ let category_fd = match self . openat ( category, OFlags :: RDONLY | OFlags :: DIRECTORY ) {
517+ Ok ( fd) => fd,
518+ Err ( Errno :: NOENT ) => {
519+ return Ok ( objects) ;
520+ }
521+ Err ( other) => {
522+ return Err ( other) . context ( "Opening {category} dir in repository" ) ?;
523+ }
524+ } ;
517525
518- let refs = openat (
526+ match openat (
519527 & category_fd,
520528 "refs" ,
521529 OFlags :: RDONLY | OFlags :: DIRECTORY ,
522530 Mode :: empty ( ) ,
523- ) ?;
524- Self :: walk_symlinkdir ( refs, & mut objects) ?;
531+ ) {
532+ Ok ( refs) => {
533+ Self :: walk_symlinkdir ( refs, & mut objects) ?;
534+ }
535+ Err ( Errno :: NOENT ) => { }
536+ Err ( other) => {
537+ return Err ( other) . context ( "Opening {category}/refs dir in repository" ) ?;
538+ }
539+ } ;
525540
526541 for item in Dir :: read_from ( & category_fd) ? {
527542 let entry = item?;
You can’t perform that action at this time.
0 commit comments