diff --git a/internal/git/housekeeping/manager/manager.go b/internal/git/housekeeping/manager/manager.go index 7f42dbf70d3c98214f57402efa07bf918329159a..306f637f10ae47e4db6f9811eb7b0d8bcbde1cdc 100644 --- a/internal/git/housekeeping/manager/manager.go +++ b/internal/git/housekeeping/manager/manager.go @@ -39,8 +39,6 @@ type repositoryState struct { // packRefsDone is a channel used to denote when the ongoing (if any) call to packRefsIfNeeded // is completed. packRefsDone chan struct{} - // packRefsInhibitors keeps a count of the number of inhibitors on running packRefsIfNeeded. - packRefsInhibitors int32 // isRunning is used to indicate if housekeeping is running. isRunning bool } @@ -127,38 +125,6 @@ func (s *repositoryStates) tryRunningHousekeeping(repo storage.Repository) (succ } } -// tryRunningPackRefs checks if we can run `git-pack-refs(1)` for a given repository. If there -// is at least one inhibitors then we return false. If there are no inhibitors, we setup the `packRefsDone` -// channel to denote when `git-pack-refs(1)` finishes, this is handled when the caller calls the -// cleanup function returned by this function. -func (s *repositoryStates) tryRunningPackRefs(repo storage.Repository) (successful bool, _ func()) { - state, cleanup := s.getState(repo) - defer func() { - if !successful { - cleanup() - } - }() - - state.Lock() - defer state.Unlock() - - if state.packRefsInhibitors > 0 || state.packRefsDone != nil { - return false, nil - } - - state.packRefsDone = make(chan struct{}) - - return true, func() { - defer cleanup() - - state.Lock() - defer state.Unlock() - - close(state.packRefsDone) - state.packRefsDone = nil - } -} - // RepositoryManager is an implementation of the Manager interface. type RepositoryManager struct { logger log.Logger diff --git a/internal/git/housekeeping/manager/optimize_repository.go b/internal/git/housekeeping/manager/optimize_repository.go index f9bdd020ab0d9d9a08e647238d6ed008ec6ace39..bc8ef1fa0f47332e5a67f51f917fb6c9de1d14fc 100644 --- a/internal/git/housekeeping/manager/optimize_repository.go +++ b/internal/git/housekeeping/manager/optimize_repository.go @@ -437,13 +437,6 @@ func (m *RepositoryManager) packRefsIfNeeded(ctx context.Context, repo *localrep return false, nil } - // If there are any inhibitors, we don't run git-pack-refs(1). - ok, cleanup := m.repositoryStates.tryRunningPackRefs(repo) - if !ok { - return false, nil - } - defer cleanup() - var stderr bytes.Buffer if err := repo.ExecAndWait(ctx, gitcmd.Command{ Name: "pack-refs",