{"thread":{"id":"2336","subject":"little conundrum","startedAt":"2005-11-03T17:41:20Z","lastAt":"2005-11-04T00:41:56Z","messageCount":12,"participants":["Alan Chandler","Peter Eriksen","Johannes Schindelin","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"11070","messageId":"200511031741.20496.alan@chandlerfamily.org.uk","threadId":"2336","inReplyTo":null,"subject":"little conundrum","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-11-03T17:41:20Z","receivedAt":"2005-11-03T17:41:20Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"I have a little problem I am trying to solve.  Tried a few things and got \nnowhere, so I thought I would ask here.\n\nI have two directories one of which contains a tree of source code that was an \noriginal software package that I downloaded.  The other contains the result \nof some unfinished - but quite substancial changes that I had made to that \nsource code.  Since this was some time ago, I don't have any records, but it \nis quite possible that I added and removed quite a few files.\n\nI would like to make myself a git repository that contains at the start, an \ninitial commit of the original downloaded source code, and a second commit on \nthe top of that that contains the the current state of play after the changes \nI have made.\n\nSince I don't actually have a list of the files, I thought I would establish \nthese automatically by going into each directory and doing a cg-init.  So I \nnow have two disjoint repositories each with their source tree in it.\n\nMy next thought was to add a branch to one of them and then pull the resultant \ncode over and merge it using cg-branch-add followed by a cg-update.  But when \nI do that it complains that there is no common base.  \n\nI tried creating an empty directory and separately merging the two versions \nwith it, so that I have a common parent, but whatever I do, I can't get one \nof those nice little gitk diagrams that has any linkage between the two \nversions of the source code.\n\nIs there an approach I could take to achieve what I want?\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"11080","messageId":"Pine.LNX.4.63.0511031845410.3435@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2336","inReplyTo":"200511031741.20496.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-03T17:47:56Z","receivedAt":"2005-11-03T17:47:56Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 3 Nov 2005, Alan Chandler wrote:\n\n> I would like to make myself a git repository that contains at the start, \n> an initial commit of the original downloaded source code, and a second \n> commit on the top of that that contains the the current state of play \n> after the changes I have made.\n\nHow about this:\n\n\tcd orig/\n\tgit-init-db\n\tgit-add $(find * -type f)\n\tgit-commit -m \"initial\"\n\tcd ../modified\n\tmv ../orig/.git ./\n\tgit-add $(find * -type f)\n\tgit-commit -a -m \"my modifications\"\n\nOf course -- in the great tradition of this list -- totally untested.\n\nHth,\nDscho\n"},{"id":"11071","messageId":"20051103181002.GA26437@bohr.gbar.dtu.dk","threadId":"2336","inReplyTo":"200511031741.20496.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2005-11-03T18:10:03Z","receivedAt":"2005-11-03T18:10:03Z","isPatch":false,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"On Thu, Nov 03, 2005 at 05:41:20PM +0000, Alan Chandler wrote:\n> I have a little problem I am trying to solve.  Tried a few things and got \n> nowhere, so I thought I would ask here.\n> \n> I have two directories one of which contains a tree of source code that was an \n> original software package that I downloaded.  The other contains the result \n> of some unfinished - but quite substancial changes that I had made to that \n> source code.  Since this was some time ago, I don't have any records, but it \n> is quite possible that I added and removed quite a few files.\n> \n> I would like to make myself a git repository that contains at the start, an \n> initial commit of the original downloaded source code, and a second commit on \n> the top of that that contains the the current state of play after the changes \n> I have made.\n\nWhat I read from this, is that you could do something like (with Git,\nbut I suppose Cogito is very similar):\n\n]cd original\n]git-init-db\n]git-add all-the-files\n]git-commit -m \"Initial import\"\n]cp -rf ../modified/* .\n]git-status\n...fix things up adding and deleting files\n]git-commit -m \"First big change\n\nThe point is, I think git-status will tell you about any\nmodifications you have made by just overwriting the original\ntree with the modified one.\n\nPeter\n"},{"id":"11073","messageId":"200511031848.58040.alan@chandlerfamily.org.uk","threadId":"2336","inReplyTo":"20051103181002.GA26437@bohr.gbar.dtu.dk","subject":"Re: little conundrum","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-11-03T18:48:57Z","receivedAt":"2005-11-03T18:48:57Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Thursday 03 Nov 2005 18:10, Peter Eriksen wrote:\n> On Thu, Nov 03, 2005 at 05:41:20PM +0000, Alan Chandler wrote:\n> > I have a little problem I am trying to solve.  Tried a few things and got\n> > nowhere, so I thought I would ask here.\n> >\n> > I have two directories one of which contains a tree of source code that\n> > was an original software package that I downloaded.  The other contains\n> > the result of some unfinished - but quite substancial changes that I had\n> > made to that source code.  Since this was some time ago, I don't have any\n> > records, but it is quite possible that I added and removed quite a few\n> > files.\n\n> What I read from this, is that you could do something like (with Git,\n> but I suppose Cogito is very similar):\n>\n> ]cd original\n> ]git-init-db\n> ]git-add all-the-files\n> ]git-commit -m \"Initial import\"\n> ]cp -rf ../modified/* .\n> ]git-status\n> ...fix things up adding and deleting files\n> ]git-commit -m \"First big change\n>\n> The point is, I think git-status will tell you about any\n> modifications you have made by just overwriting the original\n> tree with the modified one.\n\n\nThe advantage of cg-init (as opposed git-init-db) is that it finds all the \nfiles to add.\n\nI just did a quick trial of this, and it appears that git-status does not \nnotice deleted or added files.\n\nThat is one of the major issues that was worrying me - that I didn't miss any \nof those.  \n\nThere is a manual workaround - I have just run up kdiff3 (from kde) on the two \ndirectories and it is showing 59 file differences (as opposed to the 21 \nreported by git-status).  So I could go down them one by one and deal with \nthem.\n\nBut I was hoping there was an automated method:-(\n\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"11076","messageId":"20051103191652.GA28273@bohr.gbar.dtu.dk","threadId":"2336","inReplyTo":"200511031848.58040.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2005-11-03T19:16:52Z","receivedAt":"2005-11-03T19:16:52Z","isPatch":false,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"On Thu, Nov 03, 2005 at 06:48:57PM +0000, Alan Chandler wrote:\n> On Thursday 03 Nov 2005 18:10, Peter Eriksen wrote:\n[snip]\n> > ]cd original\n> > ]git-init-db\n> > ]git-add all-the-files\n> > ]git-commit -m \"Initial import\"\n> > ]cp -rf ../modified/* .\n> > ]git-status\n> > ...fix things up adding and deleting files\n> > ]git-commit -m \"First big change\n\nPerhaps something like this is better (now I actually tried it out):\n\n]rm -rf linux-2.6/.git\n]cp -r linux-2.6 peter-2.6\n...Initialize a repo in linux-2.6 with cg-init or similar and commit.\n...Remove, add and change files in peter-2.6.\n]mv linux-2.6/.git peter-2.6/.git\n]cd peter-2.6/\n]git-status\n\nHow does this work for you?\n\nPeter\n"},{"id":"11078","messageId":"200511031930.28929.alan@chandlerfamily.org.uk","threadId":"2336","inReplyTo":"20051103191652.GA28273@bohr.gbar.dtu.dk","subject":"Re: little conundrum","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-11-03T19:30:28Z","receivedAt":"2005-11-03T19:30:28Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Thursday 03 Nov 2005 19:16, Peter Eriksen wrote:\n\n>\n> Perhaps something like this is better (now I actually tried it out):\n>\n> ]rm -rf linux-2.6/.git\n> ]cp -r linux-2.6 peter-2.6\n> ...Initialize a repo in linux-2.6 with cg-init or similar and commit.\n> ...Remove, add and change files in peter-2.6.\n> ]mv linux-2.6/.git peter-2.6/.git\n> ]cd peter-2.6/\n> ]git-status\n>\n> How does this work for you?\n\nThis is the same as before.  It lists the modified files, but it doesn't tell \nyou about any added or deleted files.\n\n[I have done this manually now - originally I thought that there were quite a \nfew files - but once I had stripped out things like \"tags\" and some spurious \ndirectories that were empty it ended up being only three files:-).  So its \nonly an intellectual exercise now:-)]\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"11079","messageId":"20051103193644.GB28273@bohr.gbar.dtu.dk","threadId":"2336","inReplyTo":"200511031930.28929.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2005-11-03T19:36:45Z","receivedAt":"2005-11-03T19:36:45Z","isPatch":false,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"On Thu, Nov 03, 2005 at 07:30:28PM +0000, Alan Chandler wrote:\n...\n> This is the same as before.  It lists the modified files, but it doesn't tell \n> you about any added or deleted files.\n\nThat's odd, because I get this (shortened) output with Git current:\n\n~/peter-2.6]git-status\n#\n# Changed but not updated:\n#   (use git-update-index to mark for commit)\n#\n#       deleted:  README\n#       deleted:  REPORTING-BUGS\n#       deleted:  arch/mips/mips-boards/atlas/Makefile\n#       deleted:  arch/mips/mips-boards/sead/sead_setup.c\n#       modified: fs/fs-writeback.c\n#       deleted:  init/Kconfig\n#       deleted:  init/Makefile\n#       deleted:  init/calibrate.c\n#\n#\n# Untracked files:\n#   (use \"git add\" to add to commit)\n#\n#       drivers/media/MAINTAINERS\n#       drivers/parport/mips-boards/atlas/Makefile\n#       drivers/parport/mips-boards/atlas/atlas_gdb.c\n#       drivers/parport/mips-boards/sead/sead_setup.c\n#       fs/fs-writeback.c~\nnothing to commit\n\n\n> [I have done this manually now - originally I thought that there were quite a \n> few files - but once I had stripped out things like \"tags\" and some spurious \n> directories that were empty it ended up being only three files:-).  So its \n> only an intellectual exercise now:-)]\n\nBe careful to remember to add any links.  At least with Git when\nI last tried importing directories containing them.\n\nPeter\n"},{"id":"11081","messageId":"20051103200631.GJ1431@pasky.or.cz","threadId":"2336","inReplyTo":"200511031741.20496.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-03T20:06:31Z","receivedAt":"2005-11-03T20:06:31Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Nov 03, 2005 at 06:41:20PM CET, I got a letter\nwhere Alan Chandler <alan@chandlerfamily.org.uk> told me that...\n> Since I don't actually have a list of the files, I thought I would establish \n> these automatically by going into each directory and doing a cg-init.  So I \n> now have two disjoint repositories each with their source tree in it.\n> \n> My next thought was to add a branch to one of them and then pull the resultant \n> code over and merge it using cg-branch-add followed by a cg-update.  But when \n> I do that it complains that there is no common base.  \n> \n> I tried creating an empty directory and separately merging the two versions \n> with it, so that I have a common parent, but whatever I do, I can't get one \n> of those nice little gitk diagrams that has any linkage between the two \n> versions of the source code.\n\nThe empty directory is the good approach to do the merge, but you are\ngoing to get a huge number of conflicts. Anyway, this is probably the\nmost sensible behaviour for cg-merge, so I added cg-merge -j which does\nexactly that - use empty tree as a base for three-way merge.\n\nBut you actually do not want to do a merge, but:\n\n\t$ cd original-version\n\t$ cg-init\n\t$ cd ../modified-version\n\t$ cg-init\n\t$ cg-branch-add orig ../original-version\n\t$ cg-fetch orig\n\t$ echo `cg-object-id` `cg-object-id orig` >.git/info/grafts\n\nVoila, now your commit in 'modified' has the commit in 'original' as its\nparent.\n\nPS: And to be able to even commit the cg-merge -j, I had to back out the\ngit-read-tree -u usage in cg-Xlib's tree_timewarp, which made it racy as\nhell - basically, it could be argued that it working _properly_ would be\na race now. Besides, keeping local changes wouldn't work, and stuff.\ncg-admin-uncommit was painfully broken.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"},{"id":"11087","messageId":"20051103205729.GC28273@bohr.gbar.dtu.dk","threadId":"2336","inReplyTo":"Pine.LNX.4.63.0511031845410.3435@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: little conundrum","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2005-11-03T20:57:29Z","receivedAt":"2005-11-03T20:57:29Z","isPatch":false,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"On Thu, Nov 03, 2005 at 06:47:56PM +0100, Johannes Schindelin wrote:\n...\n> How about this:\n> \n> \tcd orig/\n> \tgit-init-db\n> \tgit-add $(find * -type f)\n> \tgit-commit -m \"initial\"\n> \tcd ../modified\n> \tmv ../orig/.git ./\n> \tgit-add $(find * -type f)\n> \tgit-commit -a -m \"my modifications\"\n\nAs I stated in another message be careful with links because\nthey are not of \"-type f\".  In addition do\n\nfind * -type l\n\nor at least keep in mind what is really going on.\n\nPeter \n"},{"id":"11091","messageId":"200511032202.18900.alan@chandlerfamily.org.uk","threadId":"2336","inReplyTo":"Pine.LNX.4.63.0511031845410.3435@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: little conundrum","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-11-03T22:02:18Z","receivedAt":"2005-11-03T22:02:18Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Thursday 03 Nov 2005 17:47, Johannes Schindelin wrote:\n> Hi,\n>\n> On Thu, 3 Nov 2005, Alan Chandler wrote:\n> > I would like to make myself a git repository that contains at the start,\n> > an initial commit of the original downloaded source code, and a second\n> > commit on the top of that that contains the the current state of play\n> > after the changes I have made.\n>\n> How about this:\n>\n> \tcd orig/\n> \tgit-init-db\n> \tgit-add $(find * -type f)\n> \tgit-commit -m \"initial\"\n> \tcd ../modified\n> \tmv ../orig/.git ./\n> \tgit-add $(find * -type f)\n> \tgit-commit -a -m \"my modifications\"\n>\n> Of course -- in the great tradition of this list -- totally untested.\n\nAlso untested, but what about removing the files from the index that aren't in \nthe working directory?\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"11094","messageId":"200511032217.14362.alan@chandlerfamily.org.uk","threadId":"2336","inReplyTo":"20051103200631.GJ1431@pasky.or.cz","subject":"Re: little conundrum","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-11-03T22:17:14Z","receivedAt":"2005-11-03T22:17:14Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Thursday 03 Nov 2005 20:06, Petr Baudis wrote:\n...\n> But you actually do not want to do a merge, but:\n>\n> \t$ cd original-version\n> \t$ cg-init\n> \t$ cd ../modified-version\n> \t$ cg-init\n> \t$ cg-branch-add orig ../original-version\n> \t$ cg-fetch orig\n> \t$ echo `cg-object-id` `cg-object-id orig` >.git/info/grafts\n\n\nvery nice\n\nI didn't know about the grafts stuff, but I can see what its doing.\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"11103","messageId":"Pine.LNX.4.63.0511040141100.6044@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2336","inReplyTo":"200511032202.18900.alan@chandlerfamily.org.uk","subject":"Re: little conundrum","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-04T00:41:56Z","receivedAt":"2005-11-04T00:41:56Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 3 Nov 2005, Alan Chandler wrote:\n\n> Also untested, but what about removing the files from the index that \n> aren't in the working directory?\n\nIIRC \"git-commit -a\" includes \"git-update-index --remove\".\n\nHth,\nDscho\n"}]}