{"thread":{"id":"14770","subject":"Re: Merging submodules (was Re: Feature suggestion: git-hist)","startedAt":"2008-07-30T23:03:37Z","lastAt":"2008-08-04T14:06:39Z","messageCount":18,"participants":["Brian Gernhardt","H.Merijn Brand","Petr Baudis","Santi Béjar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85705","messageId":"20080730230336.GA6481@Hermes","threadId":"14770","inReplyTo":null,"subject":"Re: Merging submodules (was Re: Feature suggestion: git-hist)","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2008-07-30T23:03:37Z","receivedAt":"2008-07-30T23:03:37Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"This message got eaten by a syntax error somewhere.  This is a re-send, sorry for any duplicate messages.\n\nOn Jul 30, 2008, at 12:26 PM, H.Merijn Brand wrote:\n\n> On Wed, 30 Jul 2008 11:15:55 -0400, Brian Gernhardt\n> <benji@silverinsanity.com> wrote:\n> \n> > Then you do something like:\n> > \n> > rm -rf module_{a,b,c}/.git # Do this in a test repository, obviously...\n> > git add module_a module_b module_c\n> > git commit # Needed because '-s ours' uses current HEAD, not index\n> \n> So far so good.\n> \n> > git merge --no-commit -s ours module_a/master module_b/master module_c/master\n> \n> $ git merge --no-commit -s ours fnc/master i00f000/master\n> i99f000/master include/master l00m000/master l01f000/master\n> l02f000/master l03f000/master l06f000/master l90z000/master\n> leerpl/master mutbev/master prtabel/master rpt/master tabellen/master\n> zoomen/master Automatic merge went well; stopped before committing as\n> requested\n> \n> > git commit --amend\n> \n> $ git commit --amend\n> fatal: You are in the middle of a merge -- cannot amend.\n\nHm.  I did mention this was completely untested, yes?  The problem comes\nfrom the fact that '-s ours' wants to use HEAD, not the index.  But you\ncan't amend a normal commit into a merge, apparently.  And I don't think\nyou want a commit that adds the files and a commit that \"does the merge\"\nas two separate steps.\n\nWell, I don't know how to make the porcelain do this then. But the\nplumbing can definitely do it.  Hopefully someone more used to doing\nstrange things like this can give a simpler recipe, but this should\nwork.\n\n# First reset to the commit you made with all the modules added.\nvim commit-message # Create a merge message\ncommit=$(git commit-tree HEAD: -p HEAD^ -p module_a/master -p\n\t\tmodule_b/master -p module_c/master < commit-message)\ngit update-ref HEAD $commit  # Update your current ref\n\n~~ Brian\n"},{"id":"85735","messageId":"20080731092104.1a6ce8bd@pc09.procura.nl","threadId":"14770","inReplyTo":"20080730230336.GA6481@Hermes","subject":"Re: Merging submodules (was Re: Feature suggestion: git-hist)","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-07-31T07:21:04Z","receivedAt":"2008-07-31T07:21:04Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Wed, 30 Jul 2008 19:03:37 -0400, Brian Gernhardt\n<benji@silverinsanity.com> wrote:\n\n> This message got eaten by a syntax error somewhere.  This is a re-send, sorry for any duplicate messages.\n> \n> On Jul 30, 2008, at 12:26 PM, H.Merijn Brand wrote:\n> \n> > On Wed, 30 Jul 2008 11:15:55 -0400, Brian Gernhardt\n> > <benji@silverinsanity.com> wrote:\n> > \n> > > Then you do something like:\n> > > \n> > > rm -rf module_{a,b,c}/.git # Do this in a test repository, obviously...\n> > > git add module_a module_b module_c\n> > > git commit # Needed because '-s ours' uses current HEAD, not index\n> > \n> > So far so good.\n> > \n> > > git merge --no-commit -s ours module_a/master module_b/master module_c/master\n> > \n> > $ git merge --no-commit -s ours fnc/master i00f000/master\n> > i99f000/master include/master l00m000/master l01f000/master\n> > l02f000/master l03f000/master l06f000/master l90z000/master\n> > leerpl/master mutbev/master prtabel/master rpt/master tabellen/master\n> > zoomen/master Automatic merge went well; stopped before committing as\n> > requested\n> > \n> > > git commit --amend\n> > \n> > $ git commit --amend\n> > fatal: You are in the middle of a merge -- cannot amend.\n> \n> Hm.  I did mention this was completely untested, yes?  The problem comes\n> from the fact that '-s ours' wants to use HEAD, not the index.  But you\n> can't amend a normal commit into a merge, apparently.  And I don't think\n> you want a commit that adds the files and a commit that \"does the merge\"\n> as two separate steps.\n> \n> Well, I don't know how to make the porcelain do this then. But the\n> plumbing can definitely do it.  Hopefully someone more used to doing\n> strange things like this can give a simpler recipe, but this should\n> work.\n> \n> # First reset to the commit you made with all the modules added.\n> vim commit-message # Create a merge message\n> commit=$(git commit-tree HEAD: -p HEAD^ -p module_a/master -p\n                                 ^^^^^^^^\nhad to remove that part\n\n> \t\tmodule_b/master -p module_c/master < commit-message)\n> git update-ref HEAD $commit  # Update your current ref\n\nSome history\n---\nI'm aware I started at the wrong end of being a git user. I had to move\nfrom SCCS to `something better', and at that point only git, svn, and\nhq seemed to be likely candidates.\n\nhq being python, and our company not using python, but perl, made that\nan easy drop. I gave up compiling svn on HP-UX in 64bit mode after\nabout a week, mainly because it depended on way too many things, and\nthe new VCS has to run on this platform, as it is our main development\nsystem. I got git up and running in two days (compile in less than two\nhours, but then I got to chase HP-UX and 64bit oddities).\n\nBy the I knew a lot about the git source code, make files, and test\nscripts, but still had no idea about the whole plumbing/porcelain\napproach. The plan was to make that someone else's job.\n\nOnce it was up and running, I had to create a way to convert all our\nSCCS repo's to git, so we could get started and test if it met our\nneeds. That part went smooth, and with a little help from Sam Villain\nto get some speed into the conversions using git-fast-import, it is now\navailable to the public on CPAN as VCS::SCCS, with git2sccs in the\nexamples folder.\n\nUsing git-gui and gitk my users were enthousiastic, and they saw all\nthe advantages of using git over SCCS. Of course, with every change\nthere are a few (serious) drawbacks, but we have to live with those.\n\nBeing a perl5 porter/maintainer, I was used to p4v (perforce) and still\nwonder why there are two GUI's instead of just one, and why they don't\noffer the functionality I love in p4v. Not that I think perforce is\nbetter than git, but their GUI certainly is.\n---\n\nSo, back to this merging issue. Now you might understand why I have all\nthose `silly' questions and have (still) no good idea of what all these\ncommands do. (The person that were to do all that never came into the\npicture). I'm learning.\n\nI'm VERY happy and thankful for the help I get from you here, and I get\nthe impression that my feedback on getting git running in our somewhat\ndifferent environment to you is also appreciated.\n\nI had to cut down my number of modules to merge, as I got an error that\nthe maximum number of merges was 16. I had 18.\n\nI will now be playing with the results a bit. I have attached the\nscript, in case you might want to use it in documentation or examples.\nFor now, all the mods are hardcoded. No arguments and so on.\n\nAgain, Thanks!\n\n$ bash git-merge-mods.sh\nRe-initialize GIT repo\nInitialized empty Git repository in /work/lep/4gl/.git/\nRecovering original module repo's\nFetching for i00f000\nremote: Counting objects: 24, done.\nremote: Compressing objects: 100% (14/14), done.\nremote: Total 24 (delta 9), reused 24 (delta 9)\nUnpacking objects: 100% (24/24), done.\nFrom i00f000\n * [new branch]      master     -> i00f000/master\nFetching for i99f000\n:\n:\nReceiving objects: 100% (356/356), 139.05 KiB, done.\nResolving deltas: 100% (180/180), done.\nFrom rpt\n * [new branch]      master     -> rpt/master\nRemoving module repo's\nAdding modules\nCommit\nMerge\nAutomatic merge went well; stopped before committing as requested\nCommit\n=========\n53229f046c5d85d11bbd500cf04b468fd3f62c08\n=========\nUpdate\n$\n\n\n\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85770","messageId":"20080731143955.034f0577@pc09.procura.nl","threadId":"14770","inReplyTo":"20080731092104.1a6ce8bd@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-07-31T12:39:55Z","receivedAt":"2008-07-31T12:39:55Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Thu, 31 Jul 2008 09:21:04 +0200, \"H.Merijn Brand\"\n<h.m.brand@xs4all.nl> wrote:\n\n> I will now be playing with the results a bit. I have attached the\n> script, in case you might want to use it in documentation or examples.\n> For now, all the mods are hardcoded. No arguments and so on.\n> \n> Again, Thanks!\n\nThere is a slight problem with this merging approach. The path names\nare as they are/were in the submodules. In module_a, foo.pl was without\na leading module_a/ path, and now after integration, it still is. Is it\npossible to rethink this whole process that integrates/merges the\nseveral git repo's in subfolders into the current folder, as-if they\nwould have been in this folder in the first place?\n\nShort summary: History made me have the current situation\n\n\t4gl\n\t4gl/fnc\n\t4gl/fnc/.git\n\t4gl/foo\n\t4gl/foo/.git\n\t:\n\t:\n\t4gl/zlork\n\t4gl/zlork/.git\n\nWhere I want\n\n\t4gl\n\t4gl/.git\n\t4gl/fnc\n\t4gl/foo\n\t:\n\t4gl/zlork\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85778","messageId":"20080731130626.GQ32184@machine.or.cz","threadId":"14770","inReplyTo":"20080731143955.034f0577@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-07-31T13:06:26Z","receivedAt":"2008-07-31T13:06:26Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Thu, Jul 31, 2008 at 02:39:55PM +0200, H.Merijn Brand wrote:\n> On Thu, 31 Jul 2008 09:21:04 +0200, \"H.Merijn Brand\"\n> <h.m.brand@xs4all.nl> wrote:\n> \n> > I will now be playing with the results a bit. I have attached the\n> > script, in case you might want to use it in documentation or examples.\n> > For now, all the mods are hardcoded. No arguments and so on.\n> > \n> > Again, Thanks!\n> \n> There is a slight problem with this merging approach. The path names\n> are as they are/were in the submodules. In module_a, foo.pl was without\n> a leading module_a/ path, and now after integration, it still is. Is it\n> possible to rethink this whole process that integrates/merges the\n> several git repo's in subfolders into the current folder, as-if they\n> would have been in this folder in the first place?\n\nI would suggest re-reading Santi's suggestions:\n\n> You have, basically, two possibilities:\n> \n> 1) Add the module_# as submodules:\n>   http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html\n>   http://git.or.cz/gitwiki/GitSubmoduleTutorial\n> 2) Add the submodules as subtrees (as gitk and git-gui in git.git)\n>   http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n\nI think the latter is specifically what you want.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nAs in certain cults it is possible to kill a process if you know\nits true name.  -- Ken Thompson and Dennis M. Ritchie\n"},{"id":"85779","messageId":"8aa486160807310617o1a1cf8ddtdee3a43c2835d552@mail.gmail.com","threadId":"14770","inReplyTo":"20080731143955.034f0577@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-07-31T13:17:13Z","receivedAt":"2008-07-31T13:17:13Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, Jul 31, 2008 at 14:39, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n>\n> There is a slight problem with this merging approach. The path names\n> are as they are/were in the submodules. In module_a, foo.pl was without\n> a leading module_a/ path, and now after integration, it still is. Is it\n> possible to rethink this whole process that integrates/merges the\n> several git repo's in subfolders into the current folder, as-if they\n> would have been in this folder in the first place?\n\nIf you want to have module_a/foo.pl in the old commits you will need\nto rewrite the history, either with \"git filter-branch\" or\nfast-export/import, or importing again.\n\nFor the new commits it depends on how you would do them. If you modify\nand commit without these module subfolders (without the module_a/.git\nas your git-merge-mods does) then the new commits will have\nmodule_a/foo.pl. So at the end you will have a merge of all the mods\n(using the subtree strategy), and after that you will have a single\nproject.\n\nAll depends in a few factors, if you have published the history (for\nthe rewriting), if you want to have the module_# as independent\nprojects (this way you can merge them in other projects),...\n\nSanti\n"},{"id":"85784","messageId":"20080731170123.79e0d3e9@pc09.procura.nl","threadId":"14770","inReplyTo":"20080731130626.GQ32184@machine.or.cz","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-07-31T15:01:23Z","receivedAt":"2008-07-31T15:01:23Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Thu, 31 Jul 2008 15:06:26 +0200, Petr Baudis <pasky@suse.cz> wrote:\n\n> On Thu, Jul 31, 2008 at 02:39:55PM +0200, H.Merijn Brand wrote:\n> > On Thu, 31 Jul 2008 09:21:04 +0200, \"H.Merijn Brand\"\n> > <h.m.brand@xs4all.nl> wrote:\n> > \n> > > I will now be playing with the results a bit. I have attached the\n> > > script, in case you might want to use it in documentation or examples.\n> > > For now, all the mods are hardcoded. No arguments and so on.\n> > > \n> > > Again, Thanks!\n> > \n> > There is a slight problem with this merging approach. The path names\n> > are as they are/were in the submodules. In module_a, foo.pl was without\n> > a leading module_a/ path, and now after integration, it still is. Is it\n> > possible to rethink this whole process that integrates/merges the\n> > several git repo's in subfolders into the current folder, as-if they\n> > would have been in this folder in the first place?\n> \n> I would suggest re-reading Santi's suggestions:\n> \n> > You have, basically, two possibilities:\n> > \n> > 1) Add the module_# as submodules:\n> >   http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html\n> >   http://git.or.cz/gitwiki/GitSubmoduleTutorial\n> > 2) Add the submodules as subtrees (as gitk and git-gui in git.git)\n> >   http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n> \n> I think the latter is specifically what you want.\n\nI got stuck in that process, as the new repo thinks all the files from\nthe sub-folders belong to the top-folder: After this process, there are\na lot of files from subfolder include in the \"new\" top-level folder.\n\n--8<--- git-join.sh\n#!/bin/sh\n\nexport MODS\nMODS=\"include fnc\"\nMODS=\"$MODS i00f000 i99f000\"\nMODS=\"$MODS l00m000 l01f000 l02f000 l03f000 l06f000 l90z000\"\nMODS=\"$MODS rpt\"\nMODS=\"$MODS leerpl mutbev prtabel tabellen zoomen\"\n\necho \"Creating merge environment\"\nrm -rf new\nmkdir new\ncd new\n\necho \"Recovering original repo's\"\ntbz -s -x ../lep4gl-git\n\necho \"Initializing new repo\"\ngit init\n\nfor mod in $MODS ; do\n    echo \"Merging $mod ...\"\n    git remote add -f B$mod $mod\n    git merge -s ours --no-commit B$mod/master\n    git read-tree --prefix=$mod/ -u B$mod/master\n    git commit -m \"Merge $mod as our subdirectory\"\n    git pull -s subtree B$mod master\n    done\n\necho Done\n-->8---\n\n\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85786","messageId":"8aa486160807310824h25c9630dxc25b156e80fcdb29@mail.gmail.com","threadId":"14770","inReplyTo":"20080731170123.79e0d3e9@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-07-31T15:24:40Z","receivedAt":"2008-07-31T15:24:40Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, Jul 31, 2008 at 17:01, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> On Thu, 31 Jul 2008 15:06:26 +0200, Petr Baudis <pasky@suse.cz> wrote:\n>\n>> On Thu, Jul 31, 2008 at 02:39:55PM +0200, H.Merijn Brand wrote:\n>> >\n>> > There is a slight problem with this merging approach. The path names\n>> > are as they are/were in the submodules. In module_a, foo.pl was without\n>> > a leading module_a/ path, and now after integration, it still is. Is it\n>> > possible to rethink this whole process that integrates/merges the\n>> > several git repo's in subfolders into the current folder, as-if they\n>> > would have been in this folder in the first place?\n>>\n>> I would suggest re-reading Santi's suggestions:\n>>\n>> > You have, basically, two possibilities:\n>> >\n>> > 1) Add the module_# as submodules:\n>> >   http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html\n>> >   http://git.or.cz/gitwiki/GitSubmoduleTutorial\n>> > 2) Add the submodules as subtrees (as gitk and git-gui in git.git)\n>> >   http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n>>\n>> I think the latter is specifically what you want.\n>\n> I got stuck in that process, as the new repo thinks all the files from\n> the sub-folders belong to the top-folder: After this process, there are\n> a lot of files from subfolder include in the \"new\" top-level folder.\n>\n\nI see all OK. Can you provide a self consistent simple testcase that\nshows what is wrong?\n\n# prepare the project and the modules\nmkdir project\ncd project\ngit init\n...\nmkdir module_a\ncd module_a\ngit init\n...\n# your script\n# show what you get and what you expect, for example:\n\n$ git show HEAD:   # or something equivalent\n$ ls\n$ git status\n...\n\n> --8<--- git-join.sh\n> #!/bin/sh\n>\n> export MODS\n> MODS=\"include fnc\"\n> MODS=\"$MODS i00f000 i99f000\"\n> MODS=\"$MODS l00m000 l01f000 l02f000 l03f000 l06f000 l90z000\"\n> MODS=\"$MODS rpt\"\n> MODS=\"$MODS leerpl mutbev prtabel tabellen zoomen\"\n>\n> echo \"Creating merge environment\"\n> rm -rf new\n> mkdir new\n> cd new\n>\n> echo \"Recovering original repo's\"\n> tbz -s -x ../lep4gl-git\n>\n> echo \"Initializing new repo\"\n> git init\n>\n> for mod in $MODS ; do\n>    echo \"Merging $mod ...\"\n>    git remote add -f B$mod $mod\n>    git merge -s ours --no-commit B$mod/master\n>    git read-tree --prefix=$mod/ -u B$mod/master\n>    git commit -m \"Merge $mod as our subdirectory\"\n\n\n>    git pull -s subtree B$mod master\n\nThis is only needed when updating the subtree if the module has been\nupdated (but it should do nothing in you case).\n\n>    done\n>\n> echo Done\n> -->8---\n\nSanti\n"},{"id":"85789","messageId":"20080731201530.067be667@pc09.procura.nl","threadId":"14770","inReplyTo":"8aa486160807310824h25c9630dxc25b156e80fcdb29@mail.gmail.com","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-07-31T18:15:30Z","receivedAt":"2008-07-31T18:15:30Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Thu, 31 Jul 2008 17:24:40 +0200, \"Santi Béjar\" <sbejar@gmail.com>\nwrote:\n\n> On Thu, Jul 31, 2008 at 17:01, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> > On Thu, 31 Jul 2008 15:06:26 +0200, Petr Baudis <pasky@suse.cz> wrote:\n> >\n> >> On Thu, Jul 31, 2008 at 02:39:55PM +0200, H.Merijn Brand wrote:\n> >> >\n> >> > There is a slight problem with this merging approach. The path names\n> >> > are as they are/were in the submodules. In module_a, foo.pl was without\n> >> > a leading module_a/ path, and now after integration, it still is. Is it\n> >> > possible to rethink this whole process that integrates/merges the\n> >> > several git repo's in subfolders into the current folder, as-if they\n> >> > would have been in this folder in the first place?\n> >>\n> >> I would suggest re-reading Santi's suggestions:\n> >>\n> >> > You have, basically, two possibilities:\n> >> >\n> >> > 1) Add the module_# as submodules:\n> >> >   http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html\n> >> >   http://git.or.cz/gitwiki/GitSubmoduleTutorial\n> >> > 2) Add the submodules as subtrees (as gitk and git-gui in git.git)\n> >> >   http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n> >>\n> >> I think the latter is specifically what you want.\n> >\n> > I got stuck in that process, as the new repo thinks all the files from\n> > the sub-folders belong to the top-folder: After this process, there are\n> > a lot of files from subfolder include in the \"new\" top-level folder.\n> >\n> \n> I see all OK. Can you provide a self consistent simple testcase that\n> shows what is wrong?\n\nYes. was rather easy.\nhttp://www.xs4all.nl/~hmbrand/testcase.tgz\n\ntest 133 > ll *\n23875989 -rwxr-xr-x 1 merijn users   486 2008-07-31 20:08 git-join.sh\n23875990 -rw-rw-rw- 1 merijn users 14385 2008-07-31 20:07 test-git.tgz\n\n4gl:\ntotal 16\n23871493 drwxrwxrwx 4 merijn users 4096 2008-07-31 20:01 .\n23871492 drwxrwxrwx 3 merijn users 4096 2008-07-31 20:08 ..\n23871494 drwxrwxrwx 3 merijn users 4096 2008-07-31 19:56 fnc\n23875966 drwxrwxrwx 3 merijn users 4096 2008-07-31 20:04 include\ntest 134 > bash git-join.sh\nCreating merge environment\nRecovering original repo's\nInitializing new repo\nInitialized empty Git repository in /work/lep/test/new/.git/\nMerging include ...\nUpdating Binclude\nremote: Counting objects: 9, done.\nremote: Compressing objects: 100% (5/5), done.\nremote: Total 9 (delta 1), reused 6 (delta 1)\nUnpacking objects: 100% (9/9), done.\nFrom include\n * [new branch]      master     -> Binclude/master\nCreated commit c2c491e: Merge include as our subdirectory\n 1 files changed, 4 insertions(+), 0 deletions(-)\n create mode 100644 include/ini0.h\nFrom include\n * branch            master     -> FETCH_HEAD\nAlready up-to-date.\nMerging fnc ...\nUpdating Bfnc\nwarning: no common commits\nremote: Counting objects: 12, done.\nremote: Compressing objects: 100% (4/4), done.\nUnpacking objects: 100% (12/12), done.\nremote: Total 12 (delta 0), reused 9 (delta 0)\nFrom fnc\n * [new branch]      master     -> Bfnc/master\nAutomatic merge went well; stopped before committing as requested\nCreated commit d7da4d6: Merge fnc as our subdirectory\nFrom fnc\n * branch            master     -> FETCH_HEAD\nAlready up-to-date.\nDone\ntest 135 > ll new\ntotal 24\n23887892 drwxrwxrwx 5 merijn users 4096 2008-07-31 20:11 .\n23871492 drwxrwxrwx 4 merijn users 4096 2008-07-31 20:11 ..\n23887973 drwxrwxrwx 8 merijn users 4096 2008-07-31 20:11 .git\n23887893 drwxrwxrwx 3 merijn users 4096 2008-07-31 20:11 fnc\n23887933 drwxrwxrwx 3 merijn users 4096 2008-07-31 20:11 include\n23888029 -rw-rw-rw- 1 merijn users   56 2008-07-31 20:11 ini0.h\ntest 136 > ll new/include/\ntotal 16\n23887933 drwxrwxrwx 3 merijn users 4096 2008-07-31 20:11 .\n23887892 drwxrwxrwx 5 merijn users 4096 2008-07-31 20:11 ..\n23887934 drwxrwxrwx 8 merijn users 4096 2008-07-31 20:04 .git\n23888031 -rw-rw-rw- 1 merijn users   56 2008-07-31 20:11 ini0.h\ntest 137 >\n\nWhat is ini0.h doing in new/ ?\n\ntest 137 > cd new\ntest/new 138 > git-ls-files\nfnc/foo.txt\ninclude/ini0.h\nini0.h\ntest/new 139 >\n\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85799","messageId":"8aa486160807311203o3fb4deb8u4a5ae57818c76fab@mail.gmail.com","threadId":"14770","inReplyTo":"20080731201530.067be667@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-07-31T19:03:26Z","receivedAt":"2008-07-31T19:03:26Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, Jul 31, 2008 at 20:15, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> On Thu, 31 Jul 2008 17:24:40 +0200, \"Santi Béjar\" <sbejar@gmail.com>\n> wrote:\n>\n>> I see all OK. Can you provide a self consistent simple testcase that\n>> shows what is wrong?\n>\n> Yes. was rather easy.\n> http://www.xs4all.nl/~hmbrand/testcase.tgz\n>\n\nIt is because you cannot merge a branch with an empty branch. So, or\nyou create an initial commit in the \"superproject\"  or you create a\ncommit just moving the files of the first module as in:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/79887\n\nSanti\n"},{"id":"85819","messageId":"20080731224418.42849974@pc09.procura.nl","threadId":"14770","inReplyTo":"8aa486160807311203o3fb4deb8u4a5ae57818c76fab@mail.gmail.com","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-07-31T20:44:18Z","receivedAt":"2008-07-31T20:44:18Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Thu, 31 Jul 2008 21:03:26 +0200, \"Santi Béjar\" <sbejar@gmail.com>\nwrote:\n\n> On Thu, Jul 31, 2008 at 20:15, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> > On Thu, 31 Jul 2008 17:24:40 +0200, \"Santi Béjar\" <sbejar@gmail.com>\n> > wrote:\n> >\n> >> I see all OK. Can you provide a self consistent simple testcase that\n> >> shows what is wrong?\n> >\n> > Yes. was rather easy.\n> > http://www.xs4all.nl/~hmbrand/testcase.tgz\n> >\n> \n> It is because you cannot merge a branch with an empty branch.\n\nSuper. So I start with a .gitignore and continue this process. It\nworked!\n\n> So, or you create an initial commit in the \"superproject\" or you\n> create a commit just moving the files of the first module as in:\n> \n> http://article.gmane.org/gmane.comp.version-control.git/79887\n\nThanks again!\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85865","messageId":"20080801090422.55c6a45f@pc09.procura.nl","threadId":"14770","inReplyTo":"8aa486160807311203o3fb4deb8u4a5ae57818c76fab@mail.gmail.com","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-08-01T07:04:22Z","receivedAt":"2008-08-01T07:04:22Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Thu, 31 Jul 2008 21:03:26 +0200, \"Santi Béjar\" <sbejar@gmail.com>\nwrote:\n\n> On Thu, Jul 31, 2008 at 20:15, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> > On Thu, 31 Jul 2008 17:24:40 +0200, \"Santi Béjar\" <sbejar@gmail.com> wrote:\n> >\n> >> I see all OK. Can you provide a self consistent simple testcase that\n> >> shows what is wrong?\n> >\n> > Yes. was rather easy.\n> > http://www.xs4all.nl/~hmbrand/testcase.tgz\n> \n> It is because you cannot merge a branch with an empty branch. So, or\n> you create an initial commit in the \"superproject\"  or you create a\n> commit just moving the files of the first module as in:\n> \n> http://article.gmane.org/gmane.comp.version-control.git/79887\n\nAlmost perfect now.\n\n4gl/new 121 > git-ls-files | grep fnc_declare\ninclude/fnc_declare.h\n4gl/new 122 > git-show d971ec91a3dbc9f1f27a96e4f9b95366babd036c\ncommit d971ec91a3dbc9f1f27a96e4f9b95366babd036c\nAuthor: H.M. Brand <merijn@a5.(none)>\nDate:   Tue Jul 29 16:45:43 2008 +0200\n\n    Backward comp functie voor PV indicatie\n\ndiff --git a/fnc_declare.h b/fnc_declare.h\nindex acd686c..25d9a73 100644\n--- a/fnc_declare.h\n+++ b/fnc_declare.h\n@@ -136,6 +136,11 @@ eaf_N Indicaties    ($x1);\n eaf_N pv_datum      ($x1, $x2, $x3);\n #endif\n\n+#ifndef PV_INDICATIE\n+#define PV_INDICATIE\n+eaf_S pv_indicatie  ($x1);\n+#endif\n+\n #undef eaf_B\n #undef eaf_N\n #undef eaf_S\n4gl/new 123 >\n\nall the diffs are still showing as if they were against the folder they\nwere originally committed in. Is that correct? I would now have expected\nsomething like\n\ncommit d971ec91a3dbc9f1f27a96e4f9b95366babd036c\nAuthor: H.M. Brand <merijn@a5.(none)>\nDate:   Tue Jul 29 16:45:43 2008 +0200\n\n    Backward comp functie voor PV indicatie\n\ndiff --git a/include/fnc_declare.h b/include/fnc_declare.h\nindex acd686c..25d9a73 100644\n--- a/include/fnc_declare.h\n+++ b/include/fnc_declare.h\n@@ -136,6 +136,11 @@ eaf_N Indicaties    ($x1);\n eaf_N pv_datum      ($x1, $x2, $x3);\n #endif\n\n+#ifndef PV_INDICATIE\n+#define PV_INDICATIE\n+eaf_S pv_indicatie  ($x1);\n+#endif\n+\n #undef eaf_B\n #undef eaf_N\n #undef eaf_S\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85881","messageId":"8aa486160808010252j540a28cdw6e48027396da5248@mail.gmail.com","threadId":"14770","inReplyTo":"20080801090422.55c6a45f@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-08-01T09:52:08Z","receivedAt":"2008-08-01T09:52:08Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Aug 1, 2008 at 09:04, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n>\n> Almost perfect now.\n>\n> 4gl/new 121 > git-ls-files | grep fnc_declare\n> include/fnc_declare.h\n> 4gl/new 122 > git-show d971ec91a3dbc9f1f27a96e4f9b95366babd036c\n> commit d971ec91a3dbc9f1f27a96e4f9b95366babd036c\n> Author: H.M. Brand <merijn@a5.(none)>\n> Date:   Tue Jul 29 16:45:43 2008 +0200\n>\n>    Backward comp functie voor PV indicatie\n>\n> diff --git a/fnc_declare.h b/fnc_declare.h\n> index acd686c..25d9a73 100644\n> --- a/fnc_declare.h\n> +++ b/fnc_declare.h\n> @@ -136,6 +136,11 @@ eaf_N Indicaties    ($x1);\n>  eaf_N pv_datum      ($x1, $x2, $x3);\n>  #endif\n>\n> +#ifndef PV_INDICATIE\n> +#define PV_INDICATIE\n> +eaf_S pv_indicatie  ($x1);\n> +#endif\n> +\n>  #undef eaf_B\n>  #undef eaf_N\n>  #undef eaf_S\n> 4gl/new 123 >\n>\n> all the diffs are still showing as if they were against the folder they\n> were originally committed in. Is that correct? I would now have expected\n> something like\n\nIt is correct for old commits, when you look at an old commit it\ndoesn't know that later it is merge in a subfolder. For new commits it\ndepends on how you made them, in the modules and doing a subtree merge\nor directly in the \"superproject\".\n\nSanti\n\n\n>\n> commit d971ec91a3dbc9f1f27a96e4f9b95366babd036c\n> Author: H.M. Brand <merijn@a5.(none)>\n> Date:   Tue Jul 29 16:45:43 2008 +0200\n>\n>    Backward comp functie voor PV indicatie\n>\n> diff --git a/include/fnc_declare.h b/include/fnc_declare.h\n> index acd686c..25d9a73 100644\n> --- a/include/fnc_declare.h\n> +++ b/include/fnc_declare.h\n> @@ -136,6 +136,11 @@ eaf_N Indicaties    ($x1);\n>  eaf_N pv_datum      ($x1, $x2, $x3);\n>  #endif\n>\n> +#ifndef PV_INDICATIE\n> +#define PV_INDICATIE\n> +eaf_S pv_indicatie  ($x1);\n> +#endif\n> +\n>  #undef eaf_B\n>  #undef eaf_N\n>  #undef eaf_S\n>\n> --\n> H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\n> using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n> 11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\n> http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\n> http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n>\n"},{"id":"85885","messageId":"20080801123523.33c37e08@pc09.procura.nl","threadId":"14770","inReplyTo":"8aa486160808010252j540a28cdw6e48027396da5248@mail.gmail.com","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-08-01T10:35:23Z","receivedAt":"2008-08-01T10:35:23Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Fri, 1 Aug 2008 11:52:08 +0200, \"Santi Béjar\" <sbejar@gmail.com>\nwrote:\n\n> On Fri, Aug 1, 2008 at 09:04, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> >\n> > Almost perfect now.\n> >\n> > 4gl/new 121 > git-ls-files | grep fnc_declare\n> > include/fnc_declare.h\n> > 4gl/new 122 > git-show d971ec91a3dbc9f1f27a96e4f9b95366babd036c\n> > commit d971ec91a3dbc9f1f27a96e4f9b95366babd036c\n> > Author: H.M. Brand <merijn@a5.(none)>\n> > Date:   Tue Jul 29 16:45:43 2008 +0200\n> >\n> >    Backward comp functie voor PV indicatie\n> >\n> > diff --git a/fnc_declare.h b/fnc_declare.h\n> > index acd686c..25d9a73 100644\n> > --- a/fnc_declare.h\n> > +++ b/fnc_declare.h\n> > @@ -136,6 +136,11 @@ eaf_N Indicaties    ($x1);\n> > :\n> >\n> > all the diffs are still showing as if they were against the folder they\n> > were originally committed in. Is that correct? I would now have expected\n> > something like\n> \n> It is correct for old commits, when you look at an old commit it\n> doesn't know that later it is merge in a subfolder. For new commits it\n> depends on how you made them, in the modules and doing a subtree merge\n> or directly in the \"superproject\".\n\nAfter we join/merge these into the super-project, we're going to remove\nthe sup-repos, so all new commits will be made in the super-repo.\n\nWhat I'm a bit worried about is that if people are looking for a change\nin \"include/inih001.h\", they will not be able to find the commits on\nthat path, as the old commits have stored it without the path element.\n\nWill that be a problem, or is git/gitk clever enough to still find\ncommits to both?\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"85893","messageId":"8aa486160808010434g7f3c187arc107b994e737cd74@mail.gmail.com","threadId":"14770","inReplyTo":"20080801123523.33c37e08@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-08-01T11:34:42Z","receivedAt":"2008-08-01T11:34:42Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Aug 1, 2008 at 12:35, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n\n>\n> After we join/merge these into the super-project, we're going to remove\n> the sup-repos, so all new commits will be made in the super-repo.\n\nIf you'll remove the subrepos, the best thing would be to rewrite the\nhistory on those subrepos just moving all the path to the\ncorresponding subfolder (with git-filter-branch, and you have exactly\nwhat you need at the end of the example section in the manpage). And\nthen just do a normal merge. Or, even, you could try to create a\nproject with everything there in the correct order and location, I\ndon't know if git-filter-branch or git-fast-import/export (you have\nsome examples in git.git in contrib/fast-import) can do it, but if you\nget it, please, post it here because it can be useful for others).\n\nSanti\n"},{"id":"86182","messageId":"20080804152443.4418b3e0@pc09.procura.nl","threadId":"14770","inReplyTo":"8aa486160808010434g7f3c187arc107b994e737cd74@mail.gmail.com","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-08-04T13:24:43Z","receivedAt":"2008-08-04T13:24:43Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Fri, 1 Aug 2008 13:34:42 +0200, \"Santi Béjar\" <sbejar@gmail.com>\nwrote:\n\n> On Fri, Aug 1, 2008 at 12:35, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:\n> \n> >\n> > After we join/merge these into the super-project, we're going to remove\n> > the sup-repos, so all new commits will be made in the super-repo.\n> \n> If you'll remove the subrepos, the best thing would be to rewrite the\n> history on those subrepos just moving all the path to the\n> corresponding subfolder (with git-filter-branch, and you have exactly\n> what you need at the end of the example section in the manpage). And\n> then just do a normal merge. Or, even, you could try to create a\n> project with everything there in the correct order and location, I\n> don't know if git-filter-branch or git-fast-import/export (you have\n> some examples in git.git in contrib/fast-import) can do it, but if you\n> get it, please, post it here because it can be useful for others).\n\nI gave up, even thought I'm not satisfied with the result: Merging with\nsubtrees works, but completely ruins my view over the history, cause\ngitk shows the branches as a whole, and not `merged' by date. I did\nchange the merging process to merge the repo with the least recent\nchange date first, so that it would show up at the bottom and the\nnewest on top. This is workable, but far from perfect.\n\nThe fast-export/fast import with renaming started out fine, but\nfast-import does not merge. For the latter I (tried to) use the\nfollowing approach:\n\n--8<---\n#!/pro/bin/perl\n\nuse strict;\nuse warnings;\n\nsub usage\n{\n    my $err = shift and select STDERR;\n    print \"usage: $0 dir|repo.tar\\n\";\n    @_ and print join \"\\n\", @_, \"\";\n    exit $err;\n    } # usage\n\n-d \"new\" and die \"Dir new already exists\\n\";\n\nuse Cwd;\nuse File::Find;\nuse Getopt::Long qw(:config bundling nopermute);\nmy $opt_v = 1;\nGetOptions (\n    \"help|?\"    => sub { usage (0); },\n\n    \"v:2\"       => \\$opt_v,\n    ) or usage (1);\n\n@ARGV == 1 or usage (1);\n\nmy $tmp_archive = \"/tmp/git-join-$$.tgz\";\nEND { unlink $tmp_archive };\n\nmy $archive = shift;\nif (-d $archive) {\n    my $cwd = getcwd;\n    my @dir;\n    chdir $archive or die \"$archive: $!\\n\";\n    find (sub {\n        $_ eq \".git\" && -d $_ and push @dir, $File::Find::name;\n        }, \".\");\n    qx{ tar czf $tmp_archive @dir };\n    $archive = $tmp_archive;\n    chdir $cwd;\n    }\n\nsub pr_time\n{\n    my @d = @_;\n    sprintf \"%4d-%02d-%02d %02d:%02d:%02d\", 1900 + $d[5], ++$d[4], @d[3,2,1,0];\n    } # pr_time\n\n-f $archive && -s _ or usage (1, \"Archive is not a file\");\n\nmy @cmd =\n    $archive =~ m/\\.tar$/               ? qw( tar xf  )         :\n    $archive =~ m/\\.t(ar\\.)?gz$/        ? qw( tar xzf )         :\n    $archive =~ m/\\.t(ar\\.)?bz2?$/      ? qw( tar xhf )         :\n    usage (1, \"$archive is not a recognized archive type\");\n\nprint STDERR \"Creating merge environment\\n\";\nmkdir \"new\", 0777;\nchdir \"new\" or die \"Canot use folder new\\n\";\n\nprint STDERR \"Recovering original repo's\\n\";\nsystem @cmd, $archive;\n\nmy %modules;\nfind (sub {\n    (my $f = $File::Find::name) =~ s{^\\./}{};\n    $f =~ s{/\\.git$}{};\n    $_ eq \".git\" && -d $_ && !$modules{$f} or return;\n    print \"Found $f\\n\";\n    system \"git-log '--pretty=format:%ct' | head -1\";\n    chomp ($modules{$f} = `git-log '--pretty=format:%ct' | head -1`);\n    }, \".\");\nmy @modules = sort { $modules{$a} <=> $modules{$b} } keys %modules;\n\nsub git\n{\n    system \"git\", @_;\n    } # git\n\nmy $top = getcwd;\n\nprint STDERR \"Initializing new repo\\n\";\ngit \"init\";\n\nforeach my $mod (@modules) {\n    print STDERR \"Merging \", pr_time (localtime $modules{$mod}), \" $mod ...\\n\";\n    chdir $mod;\n\n    git \"checkout\", \"-f\";\n    git \"filter-branch\", \"--index-filter\",\n        qq{git ls-files -s | sed \"s-\\t-&$mod/-\" | }.\n         q{GIT_INDEX_FILE=$GIT_INDEX_FILE.new }.\n         q{git update-index --index-info && }.\n         q{mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE}, \"HEAD\";\n    git \"fast-export\", \"--all\", \">/tmp/git-export-$$.bin\";\n\n    chdir $top;\n    git \"fast-import\", \"</tmp/git-export-$$.bin\";\n    }\n\nprint STDERR \"Done\\n\";\n-->8---\n\nWhich looks perfect after the first import, but fails on every next\n\nUsing --force for fast-import removes every previous import, so it is\nuseless for this process.\n\nI do have to work with the repo, and that is more important than having\na perfect repo.\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"86183","messageId":"20080804134053.GK10151@machine.or.cz","threadId":"14770","inReplyTo":"20080804152443.4418b3e0@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-08-04T13:40:53Z","receivedAt":"2008-08-04T13:40:53Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Mon, Aug 04, 2008 at 03:24:43PM +0200, H.Merijn Brand wrote:\n> I do have to work with the repo, and that is more important than having\n> a perfect repo.\n\nYou might consider adopting a (relatively?) common strategy when\nimporting historical projects: Actually start the history from scratch\n(git init && git add . && git commit -m\"Initial commit\") and fine-tune\nyour historical import in a separate repository. Then, provide a script\nthat people interested in the old history can run and it will graft the\nimported history to your pure-git history.\n\nConceptually, it should be pretty simple:\n\n\tgit fetch git://perl-company.nl/sccs-import.git\n\techo initial_git_commit_sha1 last_imported_commit_sha1 \\\n\t\t>>$(git rev-parse --git-dir)/info/grafts\n\nExample of a fine-tuned script:\n\n\thttp://repo.or.cz/w/elinks.git?a=blob;f=contrib/grafthistory.sh\n\nIf you find out that the import is not perfect later on, you can just\nredo it, refetch and rewrite the info/grafts line.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"},{"id":"86186","messageId":"20080804155733.46fd3982@pc09.procura.nl","threadId":"14770","inReplyTo":"20080804134053.GK10151@machine.or.cz","subject":"Re: Merging submodules","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-08-04T13:57:33Z","receivedAt":"2008-08-04T13:57:33Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Mon, 4 Aug 2008 15:40:53 +0200, Petr Baudis <pasky@suse.cz> wrote:\n\n> On Mon, Aug 04, 2008 at 03:24:43PM +0200, H.Merijn Brand wrote:\n> > I do have to work with the repo, and that is more important than having\n> > a perfect repo.\n> \n> You might consider adopting a (relatively?) common strategy when\n> importing historical projects: Actually start the history from scratch\n> (git init && git add . && git commit -m\"Initial commit\") and fine-tune\n> your historical import in a separate repository. Then, provide a script\n> that people interested in the old history can run and it will graft the\n> imported history to your pure-git history.\n\nWe already changed the approach for converting projects from SCCS to\ncreate a recursive repo from all SCCS repo's. And that *is* perfect.\n\nProblem with the current join/merge is that there already have been\ncommits to the git repo after the SCCS convert that I do not want to\nloose.\n\n> Conceptually, it should be pretty simple:\n> \n> \tgit fetch git://perl-company.nl/sccs-import.git\n> \techo initial_git_commit_sha1 last_imported_commit_sha1 \\\n> \t\t>>$(git rev-parse --git-dir)/info/grafts\n> \n> Example of a fine-tuned script:\n> \n> \thttp://repo.or.cz/w/elinks.git?a=blob;f=contrib/grafthistory.sh\n> \n> If you find out that the import is not perfect later on, you can just\n> redo it, refetch and rewrite the info/grafts line.\n\nI'll have a look at this anyway.\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"86188","messageId":"20080804140639.GL10151@machine.or.cz","threadId":"14770","inReplyTo":"20080804155733.46fd3982@pc09.procura.nl","subject":"Re: Merging submodules","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-08-04T14:06:39Z","receivedAt":"2008-08-04T14:06:39Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Mon, Aug 04, 2008 at 03:57:33PM +0200, H.Merijn Brand wrote:\n> We already changed the approach for converting projects from SCCS to\n> create a recursive repo from all SCCS repo's. And that *is* perfect.\n\nYes, but that's orthogonal to whether to separate the imported history\nfrom the pure history? (Not that I'd want to force it upon you. If you\nhave a lot of nested repositories, the grafting can get a bit obnoxious\nif you don't automate it well, I suppose.)\n\n> Problem with the current join/merge is that there already have been\n> commits to the git repo after the SCCS convert that I do not want to\n> loose.\n\nYou could rebase these to the new initial commit. But if you already use\nGit intensively and rewriting history would create big headache for you\nat this point already, it's too late, I guess.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"}]}