LCOV - code coverage report
Current view: top level - server/git - DelegateRefDatabase.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 7 30 23.3 %
Date: 2022-11-19 15:00:39 Functions: 5 25 20.0 %

          Line data    Source code
       1             : // Copyright (C) 2019 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.server.git;
      16             : 
      17             : import java.io.IOException;
      18             : import java.util.Collection;
      19             : import java.util.List;
      20             : import java.util.Map;
      21             : import java.util.Set;
      22             : import org.eclipse.jgit.annotations.NonNull;
      23             : import org.eclipse.jgit.lib.BatchRefUpdate;
      24             : import org.eclipse.jgit.lib.ObjectId;
      25             : import org.eclipse.jgit.lib.Ref;
      26             : import org.eclipse.jgit.lib.RefDatabase;
      27             : import org.eclipse.jgit.lib.RefRename;
      28             : import org.eclipse.jgit.lib.RefUpdate;
      29             : import org.eclipse.jgit.lib.Repository;
      30             : 
      31             : /**
      32             :  * Wrapper around {@link RefDatabase} that delegates all calls to the wrapped {@link Repository}'s
      33             :  * {@link RefDatabase}.
      34             :  */
      35             : public class DelegateRefDatabase extends RefDatabase {
      36             : 
      37             :   private Repository delegate;
      38             : 
      39         134 :   public DelegateRefDatabase(Repository delegate) {
      40         134 :     this.delegate = delegate;
      41         134 :   }
      42             : 
      43             :   @Override
      44             :   public void create() throws IOException {
      45           0 :     delegate.getRefDatabase().create();
      46           0 :   }
      47             : 
      48             :   @Override
      49             :   public void close() {
      50           0 :     delegate.getRefDatabase().close();
      51           0 :   }
      52             : 
      53             :   @Override
      54             :   public boolean hasVersioning() {
      55           0 :     return delegate.getRefDatabase().hasVersioning();
      56             :   }
      57             : 
      58             :   @Override
      59             :   public boolean isNameConflicting(String name) throws IOException {
      60           0 :     return delegate.getRefDatabase().isNameConflicting(name);
      61             :   }
      62             : 
      63             :   @Override
      64             :   public Collection<String> getConflictingNames(String name) throws IOException {
      65           0 :     return delegate.getRefDatabase().getConflictingNames(name);
      66             :   }
      67             : 
      68             :   @Override
      69             :   public RefUpdate newUpdate(String name, boolean detach) throws IOException {
      70           0 :     return delegate.getRefDatabase().newUpdate(name, detach);
      71             :   }
      72             : 
      73             :   @Override
      74             :   public RefRename newRename(String fromName, String toName) throws IOException {
      75           0 :     return delegate.getRefDatabase().newRename(fromName, toName);
      76             :   }
      77             : 
      78             :   @Override
      79             :   public BatchRefUpdate newBatchUpdate() {
      80           0 :     return delegate.getRefDatabase().newBatchUpdate();
      81             :   }
      82             : 
      83             :   @Override
      84             :   public boolean performsAtomicTransactions() {
      85          97 :     return delegate.getRefDatabase().performsAtomicTransactions();
      86             :   }
      87             : 
      88             :   @Override
      89             :   public Ref exactRef(String name) throws IOException {
      90           0 :     return delegate.getRefDatabase().exactRef(name);
      91             :   }
      92             : 
      93             :   @Override
      94             :   public Map<String, Ref> exactRef(String... refs) throws IOException {
      95           0 :     return delegate.getRefDatabase().exactRef(refs);
      96             :   }
      97             : 
      98             :   @Override
      99             :   public Ref firstExactRef(String... refs) throws IOException {
     100           0 :     return delegate.getRefDatabase().firstExactRef(refs);
     101             :   }
     102             : 
     103             :   @Override
     104             :   public List<Ref> getRefs() throws IOException {
     105           0 :     return delegate.getRefDatabase().getRefs();
     106             :   }
     107             : 
     108             :   @SuppressWarnings("deprecation")
     109             :   @Override
     110             :   public Map<String, Ref> getRefs(String prefix) throws IOException {
     111           0 :     return delegate.getRefDatabase().getRefs(prefix);
     112             :   }
     113             : 
     114             :   @Override
     115             :   public List<Ref> getRefsByPrefix(String prefix) throws IOException {
     116           0 :     return delegate.getRefDatabase().getRefsByPrefix(prefix);
     117             :   }
     118             : 
     119             :   @Override
     120             :   public List<Ref> getRefsByPrefixWithExclusions(String include, Set<String> excludes)
     121             :       throws IOException {
     122           0 :     return delegate.getRefDatabase().getRefsByPrefixWithExclusions(include, excludes);
     123             :   }
     124             : 
     125             :   @Override
     126             :   public List<Ref> getRefsByPrefix(String... prefixes) throws IOException {
     127           0 :     return delegate.getRefDatabase().getRefsByPrefix(prefixes);
     128             :   }
     129             : 
     130             :   @Override
     131             :   @NonNull
     132             :   public Set<Ref> getTipsWithSha1(ObjectId id) throws IOException {
     133           1 :     return delegate.getRefDatabase().getTipsWithSha1(id);
     134             :   }
     135             : 
     136             :   @Override
     137             :   public boolean hasFastTipsWithSha1() throws IOException {
     138           0 :     return delegate.getRefDatabase().hasFastTipsWithSha1();
     139             :   }
     140             : 
     141             :   @Override
     142             :   public boolean hasRefs() throws IOException {
     143           0 :     return delegate.getRefDatabase().hasRefs();
     144             :   }
     145             : 
     146             :   @Override
     147             :   public List<Ref> getAdditionalRefs() throws IOException {
     148           0 :     return delegate.getRefDatabase().getAdditionalRefs();
     149             :   }
     150             : 
     151             :   @Override
     152             :   public Ref peel(Ref ref) throws IOException {
     153          14 :     return delegate.getRefDatabase().peel(ref);
     154             :   }
     155             : 
     156             :   @Override
     157             :   public void refresh() {
     158           0 :     delegate.getRefDatabase().refresh();
     159           0 :   }
     160             : 
     161             :   protected Repository getDelegate() {
     162         134 :     return delegate;
     163             :   }
     164             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750