* Add an empty directory?
@ 2005-08-13 17:30 Carl Baldwin
2005-08-13 18:00 ` Petr Baudis
0 siblings, 1 reply; 7+ messages in thread
From: Carl Baldwin @ 2005-08-13 17:30 UTC (permalink / raw)
To: git
Greetings,
My appologies if this has already been discussed. I've been through the
archives but could easily have missed something.
I have found it useful in the past to have the ability to add an empty
directory to the repository. With what little I know about git it seems
that this is entirely possible. It would create an empty tree object
for the new directory and insert a reference to that in the parent tree
object.
If someone could get me started I think I could find the time to create
and submit a patch to allow this. Here is what I've tried (with
0.99.4).
% mkdir test
% cd test
% git-init-db
% mkdir dir
% git-add-script dir
error: open("dir"): No such file or directory
fatal: Unable to add dir to database
Cheers,
Carl
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Carl Baldwin Systems VLSI Laboratory
Hewlett Packard Company
MS 88 work: 970 898-1523
3404 E. Harmony Rd. work: Carl.N.Baldwin@hp.com
Fort Collins, CO 80525 home: Carl@ecBaldwin.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Add an empty directory? 2005-08-13 17:30 Add an empty directory? Carl Baldwin @ 2005-08-13 18:00 ` Petr Baudis 2005-08-13 18:19 ` Carl Baldwin 2005-08-13 19:45 ` Junio C Hamano 0 siblings, 2 replies; 7+ messages in thread From: Petr Baudis @ 2005-08-13 18:00 UTC (permalink / raw) To: Carl Baldwin; +Cc: git Dear diary, on Sat, Aug 13, 2005 at 07:30:43PM CEST, I got a letter where Carl Baldwin <cnb@fc.hp.com> told me that... > Greetings, Hi, > My appologies if this has already been discussed. I've been through the > archives but could easily have missed something. > > I have found it useful in the past to have the ability to add an empty > directory to the repository. With what little I know about git it seems > that this is entirely possible. It would create an empty tree object > for the new directory and insert a reference to that in the parent tree > object. > > If someone could get me started I think I could find the time to create > and submit a patch to allow this. Here is what I've tried (with > 0.99.4). > > % mkdir test > % cd test > % git-init-db > % mkdir dir > % git-add-script dir > error: open("dir"): No such file or directory > fatal: Unable to add dir to database the object databases supports it, but the index file does not. But yes, it should be supported, I think. Some argue that this is useless, so some practical example of its usefulness might be a good motivation to get us going. :-) -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ If you want the holes in your knowledge showing up try teaching someone. -- Alan Cox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Add an empty directory? 2005-08-13 18:00 ` Petr Baudis @ 2005-08-13 18:19 ` Carl Baldwin 2005-08-13 19:41 ` Linus Torvalds 2005-08-13 19:45 ` Junio C Hamano 1 sibling, 1 reply; 7+ messages in thread From: Carl Baldwin @ 2005-08-13 18:19 UTC (permalink / raw) To: Petr Baudis; +Cc: Carl Baldwin, git Hi, On Sat, Aug 13, 2005 at 08:00:08PM +0200, Petr Baudis wrote: > the object databases supports it, but the index file does not. But yes, > it should be supported, I think. > > Some argue that this is useless, so some practical example of its > usefulness might be a good motivation to get us going. :-) That's fair. So, here goes. I don't particularly condone nor condemn any of these. - Just yesterday, I was starting a project at work. I wanted to add a doc directory as a reminder to add documentation very soon. I could not do this. - I've worked with projects that use an obj, .obj, .obj-platform or something resembling this and have checked in this directory to make sure it exists for all. Of course, a build system could be made to generate this directory when needed avoiding the need to check it in. - A common practice I've seen with autotools is to use a config subdirectory for many of the autogenerated scripts. If I'm not mistaken older versions would not create this directory if it did not already exist. Checking it in was a convenience. The bottom line is that I don't really see many situations where it is absolutely necessary but it is a convenience. Not supporting it may seem like an artificial limit that really didn't need to be there. I'll read up on the index file when I get the chance. Cheers, Carl -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Carl Baldwin Systems VLSI Laboratory Hewlett Packard Company MS 88 work: 970 898-1523 3404 E. Harmony Rd. work: Carl.N.Baldwin@hp.com Fort Collins, CO 80525 home: Carl@ecBaldwin.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Add an empty directory? 2005-08-13 18:19 ` Carl Baldwin @ 2005-08-13 19:41 ` Linus Torvalds 2005-08-13 19:55 ` Petr Baudis 2005-08-13 20:10 ` Carl Baldwin 0 siblings, 2 replies; 7+ messages in thread From: Linus Torvalds @ 2005-08-13 19:41 UTC (permalink / raw) To: Carl Baldwin; +Cc: Petr Baudis, git On Sat, 13 Aug 2005, Carl Baldwin wrote: > > The bottom line is that I don't really see many situations where it is > absolutely necessary but it is a convenience. Not supporting it may > seem like an artificial limit that really didn't need to be there. Well, there is an argument for not supporting it, namely that the way patches work, traditionally a directory that became empty is deleted (because patches have no way of saying "remove directory" or "create directory"). So a system where the existence of a directory flows from the existence of the files within the directory will automatically always do the right thing with patches floating around. Which is a big deal for me, since most of the kernel development still ends up being done with patches. Yes, we merge things with git, but a lot of the development is about passing patches around for review and commentary. And the thing is, you can always create the directory in your workspace. Git won't care, and won't know about it, but there's really no downside to it. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Add an empty directory? 2005-08-13 19:41 ` Linus Torvalds @ 2005-08-13 19:55 ` Petr Baudis 2005-08-13 20:10 ` Carl Baldwin 1 sibling, 0 replies; 7+ messages in thread From: Petr Baudis @ 2005-08-13 19:55 UTC (permalink / raw) To: Linus Torvalds; +Cc: Carl Baldwin, git Dear diary, on Sat, Aug 13, 2005 at 09:41:45PM CEST, I got a letter where Linus Torvalds <torvalds@osdl.org> told me that... > On Sat, 13 Aug 2005, Carl Baldwin wrote: > > > > The bottom line is that I don't really see many situations where it is > > absolutely necessary but it is a convenience. Not supporting it may > > seem like an artificial limit that really didn't need to be there. > > Well, there is an argument for not supporting it, namely that the way > patches work, traditionally a directory that became empty is deleted > (because patches have no way of saying "remove directory" or "create > directory"). If we have rename patches, why couldn't our patches deal with directories as well? And git-apply, cg-patch etc might have a way to behave in a "traditional" way for non-git patches and if a patch removes all files in a directory, kill the directory. That is, I would solve this on the SCM<->patches boundary, not fundamentally limit the SCM itself. -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ If you want the holes in your knowledge showing up try teaching someone. -- Alan Cox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Add an empty directory? 2005-08-13 19:41 ` Linus Torvalds 2005-08-13 19:55 ` Petr Baudis @ 2005-08-13 20:10 ` Carl Baldwin 1 sibling, 0 replies; 7+ messages in thread From: Carl Baldwin @ 2005-08-13 20:10 UTC (permalink / raw) To: Linus Torvalds; +Cc: Carl Baldwin, Petr Baudis, git On Sat, Aug 13, 2005 at 12:41:45PM -0700, Linus Torvalds wrote: > > > On Sat, 13 Aug 2005, Carl Baldwin wrote: > > > > The bottom line is that I don't really see many situations where it is > > absolutely necessary but it is a convenience. Not supporting it may > > seem like an artificial limit that really didn't need to be there. > > Well, there is an argument for not supporting it, namely that the way > patches work, traditionally a directory that became empty is deleted > (because patches have no way of saying "remove directory" or "create > directory"). > > So a system where the existence of a directory flows from the existence of > the files within the directory will automatically always do the right > thing with patches floating around. I see your point here. However, if git supported it then any particular usage model on top of git could choose to do it either way. If it doesn't then that flexibility is not there. > Which is a big deal for me, since most of the kernel development still > ends up being done with patches. Yes, we merge things with git, but a lot > of the development is about passing patches around for review and > commentary. > > And the thing is, you can always create the directory in your workspace. > Git won't care, and won't know about it, but there's really no downside to > it. > > Linus > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Carl Baldwin Systems VLSI Laboratory Hewlett Packard Company MS 88 work: 970 898-1523 3404 E. Harmony Rd. work: Carl.N.Baldwin@hp.com Fort Collins, CO 80525 home: Carl@ecBaldwin.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Add an empty directory? 2005-08-13 18:00 ` Petr Baudis 2005-08-13 18:19 ` Carl Baldwin @ 2005-08-13 19:45 ` Junio C Hamano 1 sibling, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2005-08-13 19:45 UTC (permalink / raw) To: Petr Baudis; +Cc: git Petr Baudis <pasky@suse.cz> writes: > the object databases supports it, but the index file does not. But yes, > it should be supported, I think. I think if this is done correctly "read-tree -m -u" two-tree switch could even remove directories that existed in the old tree but not in the new tree that has become empty. On the other hand, although I haven't started looking, adding this to index file might involve a major surgery. Practically everybody expects it is does not have an directory entry. This includes reading trees, merging two or more stages, finding directory/file conflicts, etc. etc... ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-08-13 20:10 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-08-13 17:30 Add an empty directory? Carl Baldwin 2005-08-13 18:00 ` Petr Baudis 2005-08-13 18:19 ` Carl Baldwin 2005-08-13 19:41 ` Linus Torvalds 2005-08-13 19:55 ` Petr Baudis 2005-08-13 20:10 ` Carl Baldwin 2005-08-13 19:45 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).