Closed Kilatif closed 1 year ago
filter-repo absolutely can work with a repository in this state: just add the --force
option. You probably shouldn't, but you can. This should be explained in the error message; certainly when I run it in a repo like this, I get a message suggesting using that option:
Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
(expected freshly packed repo)
Please operate on a fresh clone instead. If you want to proceed
anyway, use --force.
Just repacking probably won't help: the test is trying to ensure that you're working on a fresh clone, and "there's only a single pack file" is only one of several things that filter-repo looks for. If you really want to run filter-repo on this repository, --force
is the way to do it.
The reasons for this – and the reasons why what you're trying to do is probably a bad idea – are explained in the documentation at https://github.com/newren/git-filter-repo/blob/main/Documentation/git-filter-repo.txt#L391-L436.
Thx for answering! and just to clarify. "It absolutely can work with this state" and I can use --force or "It's a bad idea" ? :)
And what exactly badly can happened with repo if I'll made force but something will go wrong?
That's exactly what's covered in the documentation I linked to :)
I've read a few times, but still need to clarify, sorry)
Am I right, that actually filter-repo works SAME with ANY repo and result will be SAME, but it strongly recommend to use it with fresh mirrored repo just to avoid data lost on user's original repos if for example they run tool not on clone, but on some original repo?
OR
filter-repo can work right way with fresh mirrored repo ONLY and that way it has many checks to avoid running on others?
The former: filter-repo works the same with any repo, the reason to use it on a fresh clone is to reduce the risk of data loss.
it's perfectly fine to use
--force
to override the safety checks as long as you're okay with filter-repo irreversibly rewriting the contents of the current repository.https://github.com/newren/git-filter-repo/blob/main/Documentation/git-filter-repo.txt#L426-L428
Got it! thx for answering)
Hi! I've also faced with issue "expected freshly packed repo". I have huge repository and all that I made:
If I understand right, problem is that making fetch was a mistake, because fetch creates new .pack file with changes delta and I found that your script has restriction to not work with > 1 pack file or 1 pack and any count of loose object.
So.. My question is: can I ask you to explain (if it not some secret maybe :) ) why are you can't work with more then 1 pack file And what do you think, maybe can help me "git gc --aggressive" command, which repack all objects and packs to one?
Thx.