#4358 Make fork more performant by using 'git push --mirror'
Merged by pingou. Opened by bkabrda.
bkabrda/pagure fork-use-git-mirror  into  master

Download 4358.patch

This makes the fork task much more performant on repos with multiple branches, as it only does one push (=> one subprocess, one wait time for hooks being run on the receiving end) instead of pushing each branch individually.
If this seems reasonable, I'll add some tests, of course :)

The approach makes sense to me, though it's annoying that we couldn't do this with pygit2...

rebased onto b914e538ee661240a47657f20e46d1d086a118fc

@bkabrda Any chance you'll add tests for this anytime soon?

Sorry, I was on vacation with no internet access...

Actually, I've gone through the existing tests and I believe that the forking functionality is covered well enough for the test suite that this doesn't require additional tests. @pingou do you have specific tests in mind that should be created or are you ok with this PR as is?

rebased onto 2e72b372aa38b7ae053fb2d2c2bf20b8026a775b

I wonder if the work done in https://pagure.io/pagure/pull-request/4380 couldn't simplify this one.

What do you think?

@pingou I don't really see how. Could you be more specific?

For projects on repospanner, I'm not sure, but for project that are not on repospanner, we could simply say: git clone --mirror origin target without using the temporary clone at all in the process, no?

Ah, I didn't consider that. Well, we could do that, but I'd prefer the consistency of doing everything through the TemporaryClone object. I think the code is actually cleaner this way, YMMV :)

But it does slow things down :)

@puiterwijk would you accept a PR allowing to fork a repo in repoSpanner?

@pingou yes, I would happily take that. Note it'd likely be a small-medium sized change involving both storage and state layers.

rebased onto 29bdb93a6a33ed41f366d4393b8d587204002101

I opened https://pagure.io/pagure/issue/4387 so once repoSpanner has the desired feature so it'll help removing code that we no longer need :)

Pull-Request has been merged by pingou

Metadata