{"thread":{"id":"5884","subject":"[RFC] separate .git from working directory","startedAt":"2006-10-11T13:23:50Z","lastAt":"2006-10-21T17:08:00Z","messageCount":12,"participants":["Nguyen Thai Ngoc Duy","Alex Riesen","Sean","Martin Waitz","Junio C Hamano","Liu Yubao"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"28598","messageId":"fcaeb9bf0610110623q365d3ffcw9ba9e11936d03a9d@mail.gmail.com","threadId":"5884","inReplyTo":null,"subject":"[RFC] separate .git from working directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-10-11T13:23:50Z","receivedAt":"2006-10-11T13:23:50Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\nI was thinking about this while reading subproject thread. In a simple\ncase, I have a repo A located at ~/project-a and another repo B\nlocated at ~/project-a/some/dir/project-b. With this setup, command\n\"find\" and other directory-recursive commands will run horribly from\n~/project-a when they go inside project-b/.git (no I don't want to\nrepack -d everytime I want to find something).\nI propose to move project-b/.git outside and place a file, say\n.gitdir, in project-b directory. git-sh-setup and setup_git_directory\nare taught to recognize .gitdir, read it to find the actual GIT_DIR\nrecorded inside .gitdir. This way git commands inside project-b should\nwork fine while I can \"find ~/project-a -name blah\" or \"grep -R blah\"\nquickly.\n.gitdir format could be  a simple shell-like format with environment\nvariable assignments.\nBTW, talking about subproject support, how about git be taught to\nignore directories which contain .gitdir so that git commands will not\nwaste time checking project-b directory?\n-- \nDuy\n"},{"id":"28600","messageId":"81b0412b0610110741q698e6512xc8a4188bac0294a4@mail.gmail.com","threadId":"5884","inReplyTo":"fcaeb9bf0610110623q365d3ffcw9ba9e11936d03a9d@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-10-11T14:41:03Z","receivedAt":"2006-10-11T14:41:03Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 10/11/06, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> Hi,\n> I was thinking about this while reading subproject thread. In a simple\n> case, I have a repo A located at ~/project-a and another repo B\n> located at ~/project-a/some/dir/project-b. With this setup, command\n> \"find\" and other directory-recursive commands will run horribly from\n> ~/project-a when they go inside project-b/.git (no I don't want to\n> repack -d everytime I want to find something).\n> I propose to move project-b/.git outside and place a file, say\n> .gitdir, in project-b directory. git-sh-setup and setup_git_directory\n\nYou can even leave the name as is: it is impossible to misunderstand\na file for directory (except on AIX). Or put the information in extended\nattributes.\n"},{"id":"28606","messageId":"BAYC1-PASMTP10003954B66E10247020A7AE140@CEZ.ICE","threadId":"5884","inReplyTo":"fcaeb9bf0610110623q365d3ffcw9ba9e11936d03a9d@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-10-11T15:43:03Z","receivedAt":"2006-10-11T15:43:03Z","isPatch":false,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Wed, 11 Oct 2006 20:23:50 +0700\n\"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> wrote:\n\n> I was thinking about this while reading subproject thread. In a simple\n> case, I have a repo A located at ~/project-a and another repo B\n> located at ~/project-a/some/dir/project-b. With this setup, command\n> \"find\" and other directory-recursive commands will run horribly from\n> ~/project-a when they go inside project-b/.git (no I don't want to\n> repack -d everytime I want to find something).\n> I propose to move project-b/.git outside and place a file, say\n> .gitdir, in project-b directory. git-sh-setup and setup_git_directory\n> are taught to recognize .gitdir, read it to find the actual GIT_DIR\n> recorded inside .gitdir. This way git commands inside project-b should\n> work fine while I can \"find ~/project-a -name blah\" or \"grep -R blah\"\n> quickly.\n> .gitdir format could be  a simple shell-like format with environment\n> variable assignments.\n\nProbably wouldn't be too hard to implement, but is it worth it?\n\nYou can export a GIT_DIR manually pretty easily if you want to move\nthe .git directory somewhere else.  Also you could make a \"git find\"\nshell script named \"gf\" that does something like:\n\n#/bin/sh\nfind \"$@\" ! -path '*/.git/*'\n\nWhich would let you type  \"gf -name blah\" and automatically ignore\nthe .git directory.\n\nSean\n"},{"id":"28618","messageId":"20061011181425.GA10922@admingilde.org","threadId":"5884","inReplyTo":"fcaeb9bf0610110623q365d3ffcw9ba9e11936d03a9d@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2006-10-11T18:14:25Z","receivedAt":"2006-10-11T18:14:25Z","isPatch":false,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"hoi :)\n\nOn Wed, Oct 11, 2006 at 08:23:50PM +0700, Nguyen Thai Ngoc Duy wrote:\n> I was thinking about this while reading subproject thread. In a simple\n> case, I have a repo A located at ~/project-a and another repo B\n> located at ~/project-a/some/dir/project-b. With this setup, command\n> \"find\" and other directory-recursive commands will run horribly from\n> ~/project-a when they go inside project-b/.git (no I don't want to\n> repack -d everytime I want to find something).\n\nno it won't.\n\nFor subprojects you really need a shared object repository.\nIn such a setup b/.git/objects would be a symlink to the parent\nobject directory.\n\nOn the other hand, you already have the same problem with\na/.git/objects.  If you really want to move .git outside of the\nworking directory you can always do so by using a symlink for\nthe entire .git directory.\n\n-- \nMartin Waitz\n"},{"id":"28636","messageId":"fcaeb9bf0610111446i35251fc9i6517cc5b3b53fe84@mail.gmail.com","threadId":"5884","inReplyTo":"20061011181425.GA10922@admingilde.org","subject":"Re: [RFC] separate .git from working directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-10-11T21:46:51Z","receivedAt":"2006-10-11T21:46:51Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 10/12/06, Martin Waitz <tali@admingilde.org> wrote:\n> For subprojects you really need a shared object repository.\n> In such a setup b/.git/objects would be a symlink to the parent\n> object directory.\n>\n> On the other hand, you already have the same problem with\n> a/.git/objects.  If you really want to move .git outside of the\n> working directory you can always do so by using a symlink for\n> the entire .git directory.\n\nI thought about symlinks. However find will follow symlinks and\ntraverse .git directories again. My goal is to prevent looking into\n.git directories\n\n>\n> --\n> Martin Waitz\n-- \nDuy\n"},{"id":"28640","messageId":"fcaeb9bf0610111455y225237cmdbaadbf294686d8e@mail.gmail.com","threadId":"5884","inReplyTo":"BAYC1-PASMTP10003954B66E10247020A7AE140@CEZ.ICE","subject":"Re: [RFC] separate .git from working directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-10-11T21:55:32Z","receivedAt":"2006-10-11T21:55:32Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 10/11/06, Sean <seanlkml@sympatico.ca> wrote:\n> You can export a GIT_DIR manually pretty easily if you want to move\n> the .git directory somewhere else.  Also you could make a \"git find\"\n> shell script named \"gf\" that does something like:\n>\n> #/bin/sh\n> find \"$@\" ! -path '*/.git/*'\n>\n> Which would let you type  \"gf -name blah\" and automatically ignore\n> the .git directory.\n\nIt should work. However I would rather use \"normal\" find than\nspecialized ones. Imagine somedays I hate find and start to love grep,\nI would have to find out --exclude option and create new \"gg\" script.\nIn worse cases where recursive commands don't support filtering, I\nhave no chance to filter out .git directories.\n\n>\n> Sean\n-- \nDuy\n"},{"id":"28642","messageId":"7vd58ysdaw.fsf@assigned-by-dhcp.cox.net","threadId":"5884","inReplyTo":"fcaeb9bf0610111446i35251fc9i6517cc5b3b53fe84@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-11T22:22:31Z","receivedAt":"2006-10-11T22:22:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n\n> I thought about symlinks. However find will follow symlinks and\n> traverse .git directories again. My goal is to prevent looking into\n> .git directories\n\nI do not think the user (i.e. the developer working in his git\ntree or git forest that hosts subprojects) should have to bend\nand move .git directories away from the directory structure he\nworks in just to please the tool (i.e. find).  In this case the\ntool has an easy way to bend itself to match what the user\nwants, which is:\n\n\tfind ... \\( -type d -name .git -prune \\) -o ...\n"},{"id":"28645","messageId":"BAYC1-PASMTP04304774C74D3847D50C60AE140@CEZ.ICE","threadId":"5884","inReplyTo":"81b0412b0610110741q698e6512xc8a4188bac0294a4@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-10-11T22:48:44Z","receivedAt":"2006-10-11T22:48:44Z","isPatch":false,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Wed, 11 Oct 2006 16:41:03 +0200\n\"Alex Riesen\" <raa.lkml@gmail.com> wrote:\n\n> You can even leave the name as is: it is impossible to misunderstand\n> a file for directory (except on AIX). Or put the information in extended\n> attributes.\n\nActually, if you just make .git a symlink to the real $GIT_DIR find won't\nrecurse into it.\n\nSean\n"},{"id":"28653","messageId":"452DBF9E.7010900@gmail.com","threadId":"5884","inReplyTo":"fcaeb9bf0610111455y225237cmdbaadbf294686d8e@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2006-10-12T04:07:58Z","receivedAt":"2006-10-12T04:07:58Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Nguyen Thai Ngoc Duy wrote:\n> On 10/11/06, Sean <seanlkml@sympatico.ca> wrote:\n>> You can export a GIT_DIR manually pretty easily if you want to move\n>> the .git directory somewhere else.  Also you could make a \"git find\"\n>> shell script named \"gf\" that does something like:\n>>\n>> #/bin/sh\n>> find \"$@\" ! -path '*/.git/*'\n>>\n>> Which would let you type  \"gf -name blah\" and automatically ignore\n>> the .git directory.\n> \n> It should work. However I would rather use \"normal\" find than\n> specialized ones. Imagine somedays I hate find and start to love grep,\n> I would have to find out --exclude option and create new \"gg\" script.\n> In worse cases where recursive commands don't support filtering, I\n> have no chance to filter out .git directories.\n> \nSubversion puts a .svn/ in every directory under control, I dislike this\nfeature, I have to use many wrapper scripts.\n\nMaybe the svk way is worth considering, it maintains a map relation\nbetween paths in repository and file system like this:\n\n$ svk checkout --list\n           depot path\t\t\tpath\n==================================================================\n//path/in/repos/hello/world.c           /path/in/fs/hello/world.c\n\nThe problem is users must maintain this map when move or delete\n/path/in/fs/hello/world.c, it's a bit annoying.\n\nsee http://svkbook.elixus.org/nightly/en/svk-book.html#svk.ref.svk.c.checkout\nfor more information.\n"},{"id":"28655","messageId":"452DCCD3.2080600@gmail.com","threadId":"5884","inReplyTo":"452DBF9E.7010900@gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2006-10-12T05:04:19Z","receivedAt":"2006-10-12T05:04:19Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Liu Yubao wrote:\n> Maybe the svk way is worth considering, it maintains a map relation\n> between paths in repository and file system like this:\n> \n> $ svk checkout --list\n>           depot path            path\n> ==================================================================\n> //path/in/repos/hello/world.c           /path/in/fs/hello/world.c\nSorry, I made a mistake, svk maintains a map of the top directory\nof checkout, not each file:\n            depot path             path\n====================================================================\n//path/in/repos/myproject                /path/to/myproject\n> \n> The problem is users must maintain this map when move or delete\n> /path/in/fs/hello/world.c, it's a bit annoying.\n> \n> see \n> http://svkbook.elixus.org/nightly/en/svk-book.html#svk.ref.svk.c.checkout\n> for more information.\n> \n"},{"id":"28656","messageId":"20061012052134.GB10922@admingilde.org","threadId":"5884","inReplyTo":"fcaeb9bf0610111446i35251fc9i6517cc5b3b53fe84@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2006-10-12T05:21:34Z","receivedAt":"2006-10-12T05:21:34Z","isPatch":false,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"hoi :)\n\nOn Thu, Oct 12, 2006 at 04:46:51AM +0700, Nguyen Thai Ngoc Duy wrote:\n> I thought about symlinks. However find will follow symlinks and\n> traverse .git directories again. My goal is to prevent looking into\n> .git directories\n\nonly with -L.\n\nBy default, find will not recurse into a symlinked directory.\n\n-- \nMartin Waitz\n"},{"id":"29522","messageId":"fcaeb9bf0610211008t9da13a5m71105d0ddd031bae@mail.gmail.com","threadId":"5884","inReplyTo":"fcaeb9bf0610110623q365d3ffcw9ba9e11936d03a9d@mail.gmail.com","subject":"Re: [RFC] separate .git from working directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-10-21T17:08:00Z","receivedAt":"2006-10-21T17:08:00Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\nAfter reading a post in VCS comparison thread mentioning /etc example.\nI think some of my patches might be useful for some users. They are\ntwo patches, tp/gitlink~1 and tp/gitlink~2 in git-pclouds.git on\nrepo.or.cz.\nThe implementation is a bit differerent from what I proposed. The\n.gitdir file (I named it .gitlink  though) contains an alternative\nname for .git dir. It would be more obvious with the following\nexample:\n\nThe standard layout:\n\na/.git\na/file\na/b/.git\na/b/file\n\nThe new layout:\n\na/.git\na/.git-b (it is actually a/b/.git)\na/file\na/b/.gitlink (whose content is \".git-b\")\na/b/file\n\nWith this I can move all .git directories to the top directory (or\njust parent directories). In /etc example, it can create a less\ncluttered directory structure. I do not submit these patches to git.\nIt needs more work IMO.\n-- \nDuy\n"}]}