{"thread":{"id":"1503","subject":"Add an empty directory?","startedAt":"2005-08-13T17:30:43Z","lastAt":"2005-08-13T20:10:26Z","messageCount":7,"participants":["Carl Baldwin","Petr Baudis","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7204","messageId":"20050813173043.GA25013@hpsvcnb.fc.hp.com","threadId":"1503","inReplyTo":null,"subject":"Add an empty directory?","fromName":"Carl Baldwin","fromEmail":"cnb@fc.hp.com","sentAt":"2005-08-13T17:30:43Z","receivedAt":"2005-08-13T17:30:43Z","isPatch":false,"sender":{"key":"cnb@fc.hp.com","avatar":null},"body":"Greetings,\n\nMy appologies if this has already been discussed.  I've been through the\narchives but could easily have missed something.\n\nI have found it useful in the past to have the ability to add an empty\ndirectory to the repository.  With what little I know about git it seems\nthat this is entirely possible.  It would create an empty tree object\nfor the new directory and insert a reference to that in the parent tree\nobject.\n\nIf someone could get me started I think I could find the time to create\nand submit a patch to allow this.  Here is what I've tried (with\n0.99.4).\n\n% mkdir test\n% cd test\n% git-init-db\n% mkdir dir\n% git-add-script dir\nerror: open(\"dir\"): No such file or directory\nfatal: Unable to add dir to database\n\nCheers,\nCarl\n\n-- \n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n Carl Baldwin                        Systems VLSI Laboratory\n Hewlett Packard Company\n MS 88                               work: 970 898-1523\n 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com\n Fort Collins, CO 80525              home: Carl@ecBaldwin.net\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"},{"id":"7205","messageId":"20050813180008.GJ5608@pasky.ji.cz","threadId":"1503","inReplyTo":"20050813173043.GA25013@hpsvcnb.fc.hp.com","subject":"Re: Add an empty directory?","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-08-13T18:00:08Z","receivedAt":"2005-08-13T18:00:08Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Aug 13, 2005 at 07:30:43PM CEST, I got a letter\nwhere Carl Baldwin <cnb@fc.hp.com> told me that...\n> Greetings,\n\nHi,\n\n> My appologies if this has already been discussed.  I've been through the\n> archives but could easily have missed something.\n> \n> I have found it useful in the past to have the ability to add an empty\n> directory to the repository.  With what little I know about git it seems\n> that this is entirely possible.  It would create an empty tree object\n> for the new directory and insert a reference to that in the parent tree\n> object.\n> \n> If someone could get me started I think I could find the time to create\n> and submit a patch to allow this.  Here is what I've tried (with\n> 0.99.4).\n> \n> % mkdir test\n> % cd test\n> % git-init-db\n> % mkdir dir\n> % git-add-script dir\n> error: open(\"dir\"): No such file or directory\n> fatal: Unable to add dir to database\n\nthe object databases supports it, but the index file does not. But yes,\nit should be supported, I think.\n\nSome argue that this is useless, so some practical example of its\nusefulness might be a good motivation to get us going. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"},{"id":"7207","messageId":"20050813181945.GA2191@hpsvcnb.fc.hp.com","threadId":"1503","inReplyTo":"20050813180008.GJ5608@pasky.ji.cz","subject":"Re: Add an empty directory?","fromName":"Carl Baldwin","fromEmail":"cnb@fc.hp.com","sentAt":"2005-08-13T18:19:45Z","receivedAt":"2005-08-13T18:19:45Z","isPatch":false,"sender":{"key":"cnb@fc.hp.com","avatar":null},"body":"Hi,\n\nOn Sat, Aug 13, 2005 at 08:00:08PM +0200, Petr Baudis wrote:\n> the object databases supports it, but the index file does not. But yes,\n> it should be supported, I think.\n> \n> Some argue that this is useless, so some practical example of its\n> usefulness might be a good motivation to get us going. :-)\n\nThat's fair.  So, here goes.  I don't particularly condone nor condemn\nany of these.\n\n- Just yesterday, I was starting a project at work.  I wanted to add a\n  doc directory as a reminder to add documentation very soon.  I could\n  not do this.\n\n- I've worked with projects that use an obj, .obj, .obj-platform or\n  something resembling this and have checked in this directory to make\n  sure it exists for all.  Of course, a build system could be made to\n  generate this directory when needed avoiding the need to check it in.\n\n- A common practice I've seen with autotools is to use a config\n  subdirectory for many of the autogenerated scripts.  If I'm not\n  mistaken older versions would not create this directory if it did not\n  already exist.  Checking it in was a convenience.\n\nThe bottom line is that I don't really see many situations where it is\nabsolutely necessary but it is a convenience.  Not supporting it may\nseem like an artificial limit that really didn't need to be there.\n\nI'll read up on the index file when I get the chance.\n\nCheers,\nCarl\n\n\n-- \n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n Carl Baldwin                        Systems VLSI Laboratory\n Hewlett Packard Company\n MS 88                               work: 970 898-1523\n 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com\n Fort Collins, CO 80525              home: Carl@ecBaldwin.net\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"},{"id":"7213","messageId":"Pine.LNX.4.58.0508131238150.3553@g5.osdl.org","threadId":"1503","inReplyTo":"20050813181945.GA2191@hpsvcnb.fc.hp.com","subject":"Re: Add an empty directory?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-13T19:41:45Z","receivedAt":"2005-08-13T19:41:45Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 13 Aug 2005, Carl Baldwin wrote:\n> \n> The bottom line is that I don't really see many situations where it is\n> absolutely necessary but it is a convenience.  Not supporting it may\n> seem like an artificial limit that really didn't need to be there.\n\nWell, there is an argument for not supporting it, namely that the way \npatches work, traditionally a directory that became empty is deleted \n(because patches have no way of saying \"remove directory\" or \"create \ndirectory\").\n\nSo a system where the existence of a directory flows from the existence of \nthe files within the directory will automatically always do the right \nthing with patches floating around.\n\nWhich is a big deal for me, since most of the kernel development still \nends up being done with patches. Yes, we merge things with git, but a lot \nof the development is about passing patches around for review and \ncommentary.\n\nAnd the thing is, you can always create the directory in your workspace. \nGit won't care, and won't know about it, but there's really no downside to \nit. \n\n\t\t\tLinus\n"},{"id":"7212","messageId":"7v64u9mxi5.fsf@assigned-by-dhcp.cox.net","threadId":"1503","inReplyTo":"20050813180008.GJ5608@pasky.ji.cz","subject":"Re: Add an empty directory?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-13T19:45:38Z","receivedAt":"2005-08-13T19:45:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> the object databases supports it, but the index file does not. But yes,\n> it should be supported, I think.\n\nI think if this is done correctly \"read-tree -m -u\" two-tree\nswitch could even remove directories that existed in the old\ntree but not in the new tree that has become empty.\n\nOn the other hand, although I haven't started looking, adding\nthis to index file might involve a major surgery.  Practically\neverybody expects it is does not have an directory entry.  This\nincludes reading trees, merging two or more stages, finding\ndirectory/file conflicts, etc. etc...\n"},{"id":"7214","messageId":"20050813195556.GK5608@pasky.ji.cz","threadId":"1503","inReplyTo":"Pine.LNX.4.58.0508131238150.3553@g5.osdl.org","subject":"Re: Add an empty directory?","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-08-13T19:55:56Z","receivedAt":"2005-08-13T19:55:56Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Aug 13, 2005 at 09:41:45PM CEST, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> told me that...\n> On Sat, 13 Aug 2005, Carl Baldwin wrote:\n> > \n> > The bottom line is that I don't really see many situations where it is\n> > absolutely necessary but it is a convenience.  Not supporting it may\n> > seem like an artificial limit that really didn't need to be there.\n> \n> Well, there is an argument for not supporting it, namely that the way \n> patches work, traditionally a directory that became empty is deleted \n> (because patches have no way of saying \"remove directory\" or \"create \n> directory\").\n\nIf we have rename patches, why couldn't our patches deal with\ndirectories as well? And git-apply, cg-patch etc might have a way to\nbehave in a \"traditional\" way for non-git patches and if a patch removes\nall files in a directory, kill the directory.\n\nThat is, I would solve this on the SCM<->patches boundary, not\nfundamentally limit the SCM itself.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"},{"id":"7216","messageId":"20050813201026.GA21096@hpsvcnb.fc.hp.com","threadId":"1503","inReplyTo":"Pine.LNX.4.58.0508131238150.3553@g5.osdl.org","subject":"Re: Add an empty directory?","fromName":"Carl Baldwin","fromEmail":"cnb@fc.hp.com","sentAt":"2005-08-13T20:10:26Z","receivedAt":"2005-08-13T20:10:26Z","isPatch":false,"sender":{"key":"cnb@fc.hp.com","avatar":null},"body":"On Sat, Aug 13, 2005 at 12:41:45PM -0700, Linus Torvalds wrote:\n> \n> \n> On Sat, 13 Aug 2005, Carl Baldwin wrote:\n> > \n> > The bottom line is that I don't really see many situations where it is\n> > absolutely necessary but it is a convenience.  Not supporting it may\n> > seem like an artificial limit that really didn't need to be there.\n> \n> Well, there is an argument for not supporting it, namely that the way \n> patches work, traditionally a directory that became empty is deleted \n> (because patches have no way of saying \"remove directory\" or \"create \n> directory\").\n> \n> So a system where the existence of a directory flows from the existence of \n> the files within the directory will automatically always do the right \n> thing with patches floating around.\n\nI see your point here.  However, if git supported it then any particular\nusage model on top of git could choose to do it either way.  If it\ndoesn't then that flexibility is not there.\n\n> Which is a big deal for me, since most of the kernel development still \n> ends up being done with patches. Yes, we merge things with git, but a lot \n> of the development is about passing patches around for review and \n> commentary.\n> \n> And the thing is, you can always create the directory in your workspace. \n> Git won't care, and won't know about it, but there's really no downside to \n> it. \n> \n> \t\t\tLinus\n> \n\n-- \n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n Carl Baldwin                        Systems VLSI Laboratory\n Hewlett Packard Company\n MS 88                               work: 970 898-1523\n 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com\n Fort Collins, CO 80525              home: Carl@ecBaldwin.net\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"}]}