1-800-GIT-HELP question

Matthew Malcomson Matthew.Malcomson@arm.com
Wed Jan 15 11:20:00 GMT 2020


On 15/01/2020 10:13, Gaius Mulley wrote:
> 
> Hello,
> 
> Firstly many thanks to all who have worked on the git migration and also
> for the offer of help :-)
> 
> I'm seeking a little advice on an efficient way to combine the gm2 git
> repro with the gcc git repro.  When gcc was using subversion I had a
> script which untared the gm2 git over the subversion, applied local
> patches to the gcc tree and then it was ready for use.  I could git diff
> in the gm2 tree and svn diff in the gcc tree - etc.
> 
> I wonder if a similar model can be achieved now gcc uses git?
> 
> In essence the gm2 front end adds three subtrees to gcc
> 
>      libgm2
>      
>      gcc/m2
>      
>      gcc/testsuite/gm2
> 
> currently these are all in one repro
> gm2/gcc-versionno/{libgm2,gcc/m2,gcc/testsuite/gm2}.
> 
> http://git.savannah.gnu.org/cgit/gm2.git/tree
> 
> I'm a little cautious of choosing an initial working model without
> knowing the implications.  There seem to be many possible solutions
> (subtree, submodule) to name but two.
> 
> Disk space is not a concern, the time to recreate a working tree is more
> important.
> 
> regards,
> Gaius
> 

I'm not sure if you even can use a subtree/submodule at the top level -- 
I'm under the impression that when creating one you need to put the 
entire other repository in a subdirectory.
(If that's wrong please correct me -- it sounds like it might be useful 
;-) )


Maybe you could look into the `--work-tree` and `--git-dir` options?



One approach would be to have your gm2 repository information under 
`.gm2-git` and your gcc repository information under `.git`.

Then you might be able to create an alias for git that means `git gm2` 
expands to `git --git-dir=$(root directory)/.gm2-git` and everything 
should just work.

(I say might since I'm not 100% sure you can expand to `root directory` 
automatically in a git alias -- maybe through another git alias that 
says `root = !pwd`).


More information about the Gcc mailing list