[llvm-dev] [RFC] One or many git repositories?

Justin Lebar via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 22 15:30:03 PDT 2016


>> Our clones of LLVM and clang have a reasonable amount of history (a couple of hundred commits, I believe), including multiple branches, that we’d want to preserve.  Both branches have merged from upstream multiple times.  It’s one of the smaller friendly forks that I know about.  I’ve not used git filter-branch before, but I’d be very impressed if there is some simple invocation that can can move from this model.
>
> James and I owe you something here.

OK, I managed to port the master branch of the CHERI clang fork to the
existing monorepo.

The ported CHERI branch and the script James and I cooked up are at

https://github.com/jlebar/llvm-project/tree/cheri-clang-master
https://github.com/jlebar/llvm-port-commits.

At the moment, the script isn't particularly user-friendly, nor is it
at all general -- it assumes you're porting specifically a clang
branch into a branch with the format of the existing monorepo [1].  It
also assumes certain branch names.  All this can be easily fixed;
please consider it just a proof of concept.

To answer the question of how others with in-progress work would move
to the new repo, they could either

a) Run the script themselves (it takes 20 minutes to port 300 commits
on my machine, although this could be sped up ~10x, see the README),
or

b) Make a new clone from the translated monorepo upstream and then
  - exporting each commit using git format-patch
  - editing the paths in each patch (sed is sufficient), and finally
  - applying the patches to the new clone.

I can write up more explicit instructions for (b) when the time comes,
if desired.

-Justin

[1] https://github.com/llvm-project/llvm-project

On Thu, Jul 21, 2016 at 9:16 AM, Justin Lebar <jlebar at google.com> wrote:
>> Our clones of LLVM and clang have a reasonable amount of history (a couple of hundred commits, I believe), including multiple branches, that we’d want to preserve.  Both branches have merged from upstream multiple times.  It’s one of the smaller friendly forks that I know about.  I’ve not used git filter-branch before, but I’d be very impressed if there is some simple invocation that can can move from this model.
>
> James and I owe you something here.  I think this can be handled in a
> straightforward manner, but I am not 100% sure how at the moment.  I
> agree this is very important.
>
> Our demo would be much more compelling if we can use an existing
> branch.  Does anyone know of one we can play with?
>
>> In particular, the fact that we have a third more public GitHub forks of LLVM than of clang, and eight times as many as of lldb implies to me that forcing everyone downstream to pull in all subprojects would not be particularly well received.
>
> I have a hard time understanding this particular argument.  Per the
> original e-mail, with three shell commands, you can hide whichever
> llvm subprojects you want.  After doing that, the only overhead of the
> subprojects is extra space in your .git directory, which would still
> be much smaller than an llvm+clang objdir.
>
> Is there something specific that you think will not be well-received?
> Or maybe it's better to speak personally -- is there something
> specific that will bother you personally about having to clone (but
> not check out) everything?
>
> On Thu, Jul 21, 2016 at 8:22 AM, David Chisnall via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> On 21 Jul 2016, at 16:11, James Y Knight <jyknight at google.com> wrote:
>>>
>>> I don't think this is a really hard problem though -- I can think of a few ways to help existing users that probably will work (although I'd want to try them first, to ensure it actually does work, of course). The two I'm thinking of are just doing "git diff" followed by "git apply --directory=llvm" if you just want to save a patch. Or, some "git filter-branch" invocation to rename all the files in your existing repo, followed by "git rebase" (or "git merge"), if you have some more history you want to maintain.
>>
>> Our clones of LLVM and clang have a reasonable amount of history (a couple of hundred commits, I believe), including multiple branches, that we’d want to preserve.  Both branches have merged from upstream multiple times.  It’s one of the smaller friendly forks that I know about.  I’ve not used git filter-branch before, but I’d be very impressed if there is some simple invocation that can can move from this model.
>>
>> I was in favour of the GitHub migration primarily because a lot of downstream LLVM users already have a workflow based around GitHub that works well and the proposal was to make this closer to the official workflow.  I’m very nervous about a last-minute change to require everyone downstream to restructure their workflows.
>>
>> In particular, the fact that we have a third more public GitHub forks of LLVM than of clang, and eight times as many as of lldb implies to me that forcing everyone downstream to pull in all subprojects would not be particularly well received.
>>
>> David
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>


More information about the llvm-dev mailing list