Can't "Reduce repository size" after force-pushing a truncated repo
Summary
After manually truncating git history and force-pushing, git filter-repo gives no commit-map, hence your documented cleanup steps don't apply.
The same is true even with exporting a git bundle and following the docs. There are no 'refs/heads/' , 'refs/tags/' , 'refs/replace/*' files or data.
Essentially, your "repo cleanup" has a gap for this use-case, and another button-action is needed (also as an automation):
"Put the Gitlab repo in sync with the pushed edition, discarding all hidden objects and references and keep-arounds and other internal repo stuff."
Searching your forums and StackOverflow did not yield relevant info about this simple use-case.
This StackOverflow discussion mentions the simple workflow below, but not how to purge internal Gitlab items.
https://stackoverflow.com/questions/4515580/how-do-i-remove-the-old-history-from-a-git-repository
Failure to address this topic leads to "black hole" disk space consumption that the end-user (ie, myself) cannot remove.
Steps to reproduce
This public (read-only) repo consumes 2.3 Mb of local disk space after cloning. But the Gitlab repo still shows a consumption of 313.4 Mb.
This is after I manually truncated the git history, using a simple criteria of "remove everything prior to the last two commits".
$ git log | head # - Note the bottom commit hash
commit 00f3f237e4e5430bcd5dfca6bb606f72d6c77668
Author: John_DB <john@zuri.ch>
Date: Fri Dec 2 14:09:58 2022 +0100
updates
commit e1bd51fe4f550710c08f0a77c202041ade6698de
Author: John_DB <john@zuri.ch>
Date: Fri Dec 2 14:07:30 2022 +0100
$ echo 'Initial' | git commit-tree e1bd51fe4f550710c08f0a77c202041ade6698de^{tree}
xyz
$ git rebase --onto xyz e1bd51fe4f550710c08f0a77c202041ade6698de
Successfully rebased and updated refs/heads/main.
$ git push --force
Enumerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 8 threads
Compressing objects: 100% (20/20), done.
Writing objects: 100% (21/21), 2.00 MiB | 18.64 MiB/s, done.
Total 21 (delta 5), reused 0 (delta 0), pack-reused 0
To gitlab.com:umi-ch/pi.git
+ abc ... def main -> main (forced update)
$ cd ..
$ rm -r -f ./pi/
$ git clone git@gitlab.com:umi-ch/pi.git # - My SSH keys are set
...
$ cd ./pi/
$ du -sh .
2.3M .
$ git filter-repo --force --analyze
Processed 13 blob sizessively: ".git/filter-repo/analysis"
Processed 3 commits
Writing reports to .git/filter-repo/analysis...done.
$ ls -lhF .git/filter-repo/
total 0
drwxr-xr-x 11 jdb staff 352B Dec 4 19:41 analysis/
$ ls -lhF .git/filter-repo/analysis/
total 64
-rw-r--r-- 1 jdb staff 3.3K Dec 4 19:41 README
-rw-r--r-- 1 jdb staff 1.2K Dec 4 19:41 blob-shas-and-paths.txt
-rw-r--r-- 1 jdb staff 276B Dec 4 19:41 directories-all-sizes.txt
-rw-r--r-- 1 jdb staff 109B Dec 4 19:41 directories-deleted-sizes.txt
-rw-r--r-- 1 jdb staff 272B Dec 4 19:41 extensions-all-sizes.txt
-rw-r--r-- 1 jdb staff 108B Dec 4 19:41 extensions-deleted-sizes.txt
-rw-r--r-- 1 jdb staff 787B Dec 4 19:41 path-all-sizes.txt
-rw-r--r-- 1 jdb staff 151B Dec 4 19:41 path-deleted-sizes.txt
-rw-r--r-- 1 jdb staff 0B Dec 4 19:41 renames.txt
$ head .git/filter-repo/analysis/README
== Overall Statistics ==
Number of commits: 3
Number of filenames: 12
Number of directories: 4
Number of file extensions: 4
Total unpacked size (bytes): 1129013
Total packed size (bytes): 1101845
$ find . -name commit-map # - No such file
$
Example Project
What is the current bug behavior?
Cannot proceed with the documented workflow, as there is no commit-map file or data.
What is the expected correct behavior?
As this "repo shrink" function is internal to GitLab, some sort of special admin action is needed on your side to get this done, perhaps with the Rails console. But I don't have this access to your main site, nor should I.
I recommend you add a new action-button, next to the cleanup button, to handle this situation.
Relevant logs and/or screenshots
No logs other than the above. You can readily repeat this simple test with my repo.
I can readily reproduce the contents of this repo if you accidentally trash it -- no worries about that.
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
N/A
Results of GitLab application Check
N/A
I am not able to run rails check on your GitLab server.
Possible fixes
N/A