[go: up one dir, main page]

Skip to content

Manual housekeeping should allow to do a "git gc --aggressive"

Summary

If you push an "unoptimized repo", for example created trough git-p4 or other import tools, running manual housekeeping (in project settings) doesn't reduce the repository size.

Steps to reproduce

Please note that this example repo is small, but the issue will be the same with bigger ones.

  • Create an account at https://swarm.workshop.perforce.com/login
  • export P4USER=xxxx
  • export P4PORT=workshop.perforce.com:1666
  • p4 login
  • git p4 clone //guest/perforce_software/jam/src@all jam
  • Create a GitLab project
  • git remote add origin ...
  • git push -u origin master
  • Check pack size by cloning the repo => 2.9MB (same as what was pushed)
  • Run housekeeping in GitLab project settings
  • Check pack size by cloning the repo => still 2.9MB
  • git gc --agressive => pack is 412KB

Example Project

https://gitlab.com/loic.yhuel/jam

What is the current bug behavior?

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/services/projects/housekeeping_service.rb
It seems manual housekeeping still checks pushes_since_gc against the thresholds, so most of the time it only does an incremental repack (and even if a git gc is done, it doesn't seem to have the --aggressive parameter, so the effect could be limited).

What is the expected correct behavior?

Manual housekeeping should always run the full git gc, and allow git gc --agressive as an option (perhaps with a warning about the server load on big repositories).