{"thread":{"id":"12851","subject":"[bug] git-add won't add foo/.git/bar","startedAt":"2008-03-24T23:55:04Z","lastAt":"2008-03-26T19:22:04Z","messageCount":10,"participants":["Michael Gebetsroither","Julian Phillips","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72982","messageId":"fs9f0o$jge$1@ger.gmane.org","threadId":"12851","inReplyTo":null,"subject":"[bug] git-add won't add foo/.git/bar","fromName":"Michael Gebetsroither","fromEmail":"gebi@sbox.tugraz.at","sentAt":"2008-03-24T23:55:04Z","receivedAt":"2008-03-24T23:55:04Z","isPatch":false,"sender":{"key":"gebi@sbox.tugraz.at","avatar":"https://gravatar.com/avatar/b3168bab3f94cb1f09343b408b618ff2982aea3c20789c387f6d5c9b3b73999b?d=mp&s=160"},"body":"hi,\n\n% git-add -f foo/.git/bar\nfatal: unable to add foo/.git/bar to index\n\nHow do i add such a file to a git repository?\n\nthx && cu,\nmichael\n-- \nIt's already too late!\n"},{"id":"72985","messageId":"Pine.LNX.4.64.0803242359230.24262@kaos.quantumfyre.co.uk","threadId":"12851","inReplyTo":"fs9f0o$jge$1@ger.gmane.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2008-03-25T00:01:53Z","receivedAt":"2008-03-25T00:01:53Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n\n> hi,\n>\n> % git-add -f foo/.git/bar\n> fatal: unable to add foo/.git/bar to index\n\nWell, git won't allow .git as a element anywhere in the path, when we \nshould only care about the _first_ one - and also, if you use \n--git-dir=banana then we still check for '.git' ... oops.\n\npatch in the works ... ;)\n\n>\n> How do i add such a file to a git repository?\n\nwait? :P\n\nSorry, can't see any easy way to work around this atm.\n\n>\n> thx && cu,\n> michael\n>\n\n-- \nJulian\n\n  ---\n\"May the forces of evil become confused on the way to your house.\"\n-- George Carlin\n"},{"id":"72986","messageId":"7v1w5zslv5.fsf@gitster.siamese.dyndns.org","threadId":"12851","inReplyTo":"Pine.LNX.4.64.0803242359230.24262@kaos.quantumfyre.co.uk","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-25T00:11:58Z","receivedAt":"2008-03-25T00:11:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Julian Phillips <julian@quantumfyre.co.uk> writes:\n\n> On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n>\n>> hi,\n>>\n>> % git-add -f foo/.git/bar\n>> fatal: unable to add foo/.git/bar to index\n>\n> Well, git won't allow .git as a element anywhere in the path, when we\n> should only care about the _first_ one - and also, if you use\n> --git-dir=banana then we still check for '.git' ... oops.\n\nThat's not how git-dir is supposed to used, so there is no oops.\n\nAlso it is false that we should only care about the first one.  Think\nsubmodules.\n"},{"id":"72987","messageId":"Pine.LNX.4.64.0803250017450.27378@kaos.quantumfyre.co.uk","threadId":"12851","inReplyTo":"7v1w5zslv5.fsf@gitster.siamese.dyndns.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2008-03-25T00:23:34Z","receivedAt":"2008-03-25T00:23:34Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Mon, 24 Mar 2008, Junio C Hamano wrote:\n\n> Julian Phillips <julian@quantumfyre.co.uk> writes:\n>\n>> On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n>>\n>>> hi,\n>>>\n>>> % git-add -f foo/.git/bar\n>>> fatal: unable to add foo/.git/bar to index\n>>\n>> Well, git won't allow .git as a element anywhere in the path, when we\n>> should only care about the _first_ one - and also, if you use\n>> --git-dir=banana then we still check for '.git' ... oops.\n>\n> That's not how git-dir is supposed to used, so there is no oops.\n\nSo I can't _ever_ have a directory/file called '.git'?  But I _can_ add \nfiles inside my repository provided that the repository is not called \n.git?  How is that not an oops, or extremely confusing at the least?\n\ni.e.:\n\n'git add .git/fred' fails\n'git --git-dir=.git_repos --work-tree=. add .git/fred' fails\n'git --git-dir=.git_repos --work-tree=. add .git_repos/fred' works\n\n> Also it is false that we should only care about the first one.  Think\n> submodules.\n\nOk, true.  I've never used submodules, can you add things inside \nsubmodules from the parent?  If so, where do they get added - presumably \nto the submodule?\n\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\n-- \nJulian\n\n  ---\nYa'll hear about the geometer who went to the beach to catch some\nrays and became a tangent ?\n"},{"id":"72988","messageId":"7vve3br6ct.fsf@gitster.siamese.dyndns.org","threadId":"12851","inReplyTo":"7v1w5zslv5.fsf@gitster.siamese.dyndns.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-25T00:32:18Z","receivedAt":"2008-03-25T00:32:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> Well, git won't allow .git as a element anywhere in the path, when we\n>> should only care about the _first_ one - and also, if you use\n>> --git-dir=banana then we still check for '.git' ... oops.\n>\n> That's not how git-dir is supposed to used, so there is no oops.\n\nThe only purpose of git-dir is to have $GIT_DIR elsewhere _outside_ the\nwork tree.\n\nThat is, not \"git --git-dir=banana\", but \"git --git-dir=$(pwd)/../banana\"\nor more typically \"git --git-dir=/home/gits/banana.git/\" when you are at\nthe toplevel of your work tree that is unrelated to the named location.\n\n> Also it is false that we should only care about the first one.  Think\n> submodules.\n\nActually, not just \"submodules\", but even with more traditional \"overlayed\ncheckout\" with working in a subdirectory, you would have problems.\n\nYou can have another repository in your work tree, and the way we tell\nwhich path belongs to which repository is by finding .git directory in the\nhierarchy.  In my work trees of git.git, I have a clone of the repository\nitself in Meta/ and have checkout of 'todo' branch, like this:\n\n\t/git.git/.git\n        \t/COPYING\n                /Documentation\n                /Makefile\n                /Meta/.git\n                /Meta/Doit\n                /Meta/MaintNotes\n                /Meta/Make\n                ...\n\nIn such a layout, you can\n\n\t$ cd Meta\n        $ edit MaintNotes\n        $ git commit\n\nand commit the result to the /git.git/Meta/.git/ repository, while you can\n\n\t$ cd Documentation\n        $ edit git.txt\n        $ git commit\n\nand the result is committed to the main /git.git/.git/ repository.\n\nWhat this means is that you cannot have .git/ directory anywhere in your\nwork tree unless the directory that house such a .git directory as its\ndirect subdirectory (e.g. /git.git/Meta in the above illustration) unless\nthat hierarchy does not belong to the main repository (e.g. /git.git/).\n\nHaving, say Documentation/.git, in the above example is wrong because you\nwant the file Documentation/git.txt to be part of the main project.\n\nAnd trying to add Documentation/.git/garbage is doubly wrong.  For one\nthing, that path is a place to hold metainformation of the\n/git.git/Documentation/.git repository (i.e. not something you can \"git\nadd\" to the /git.git/Documentation/.git repository), and because it is\npart of /git.git/Documentation/.git repository, it should not even go to\nthe main project (i.e. not something you can \"git add\" to the main\n/git.git/.git repository either).\n\nA few weeks ago somebody wanted to rename .git and I thought I responded\nwell enough.  You certainly did not ask CVS or SVN folks to rename the\ncontrol directories they sprinkle in your work trees to .cvs or .svn, did\nyou?  Leave .git alone so that people don't get confused.\n"},{"id":"72989","messageId":"fs9i36$qck$1@ger.gmane.org","threadId":"12851","inReplyTo":"7v1w5zslv5.fsf@gitster.siamese.dyndns.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Michael Gebetsroither","fromEmail":"gebi@sbox.tugraz.at","sentAt":"2008-03-25T00:47:34Z","receivedAt":"2008-03-25T00:47:34Z","isPatch":false,"sender":{"key":"gebi@sbox.tugraz.at","avatar":"https://gravatar.com/avatar/b3168bab3f94cb1f09343b408b618ff2982aea3c20789c387f6d5c9b3b73999b?d=mp&s=160"},"body":"* Junio C Hamano <gitster@pobox.com> wrote:\n> Julian Phillips <julian@quantumfyre.co.uk> writes:\n>> On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n\n>>> % git-add -f foo/.git/bar\n>>> fatal: unable to add foo/.git/bar to index\n\n> Also it is false that we should only care about the first one.  Think\n> submodules.\n\nWould it be possible to allow it with git-add -f or does that break to\nmany cases?\n\ncu,\nmichael\n-- \nIt's already too late!\n"},{"id":"72990","messageId":"Pine.LNX.4.64.0803250045120.30488@kaos.quantumfyre.co.uk","threadId":"12851","inReplyTo":"7vve3br6ct.fsf@gitster.siamese.dyndns.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2008-03-25T00:55:56Z","receivedAt":"2008-03-25T00:55:56Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Mon, 24 Mar 2008, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>>> Well, git won't allow .git as a element anywhere in the path, when we\n>>> should only care about the _first_ one - and also, if you use\n>>> --git-dir=banana then we still check for '.git' ... oops.\n>>\n>> That's not how git-dir is supposed to used, so there is no oops.\n>\n> The only purpose of git-dir is to have $GIT_DIR elsewhere _outside_ the\n> work tree.\n\nThat's fair enough.  It's not enforced, or discourgaed in the \ndocumentation though.  Would a patch to mention that using \n--git-dir/GIT_DIR to change the name _inside_ the work tree is not \nsupported be accepted?\n\n> A few weeks ago somebody wanted to rename .git and I thought I responded\n> well enough.  You certainly did not ask CVS or SVN folks to rename the\n> control directories they sprinkle in your work trees to .cvs or .svn, did\n> you?\n\nWell, no - but then I hold git to a higher standard. ;)\n\n> Leave .git alone so that people don't get confused.\n\nAgreed, it is a) a lot simpler to explain, b) less likely to break things. \nSorry for wasting your time :$, an interesting poke around the code \nthough. :)\n\nSomething I noticed that seemed a bit odd when playing with this, should I \nexpect git to stop me from trying to add files inside subprojects to the \nmain project?  It seems to just discard the submodule and turn it into a \nnormal directory when I do.  Is that intended behaviour?\n\n-- \nJulian\n\n  ---\nExcess on occasion is exhilarating.  It prevents moderation from\nacquiring the deadening effect of a habit.\n \t\t-- W. Somerset Maugham\n"},{"id":"72993","messageId":"20080325011408.5507.86924.julian@quantumfyre.co.uk","threadId":"12851","inReplyTo":"Pine.LNX.4.64.0803250045120.30488@kaos.quantumfyre.co.uk","subject":"[PATCH] Documentation/git.txt: Mention unsupported use of --git-dir/GIT_DIR","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2008-03-25T01:10:28Z","receivedAt":"2008-03-25T01:10:28Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"We don't support using --git-dir/GIT_DIR to change the name of the\n.git directory, so make this clear in the documentation.\n\nSigned-off-by: Julian Phillips <julian@quantumfyre.co.uk>\n---\nOn Tue, 25 Mar 2008, Julian Phillips wrote:\n\n> On Mon, 24 Mar 2008, Junio C Hamano wrote:\n>\n>>  Junio C Hamano <gitster@pobox.com> writes:\n>> \n>> > >  Well, git won't allow .git as a element anywhere in the path, when\nwe\n>> > >  should only care about the _first_ one - and also, if you use\n>> > >  --git-dir=banana then we still check for '.git' ... oops.\n>> > \n>> >  That's not how git-dir is supposed to used, so there is no oops.\n>> \n>>  The only purpose of git-dir is to have $GIT_DIR elsewhere _outside_ the\n>>  work tree.\n>\n> That's fair enough.  It's not enforced, or discourgaed in the\n> documentation though.  Would a patch to mention that using --git-dir/GIT_DIR\n> to change the name _inside_ the work tree is not supported be accepted?\n\ni.e. this ...\n\n Documentation/git.txt |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 3ed24d4..28cce7f 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -134,7 +134,8 @@ help ...'.\n \n --git-dir=<path>::\n \tSet the path to the repository. This can also be controlled by\n-\tsetting the GIT_DIR environment variable.\n+\tsetting the GIT_DIR environment variable. Setting this to use a name\n+\tother than `.git` _inside_ the working tree is not supported.\n \n --work-tree=<path>::\n \tSet the path to the working tree.  The value will not be\n@@ -391,7 +392,8 @@ git so take care if using Cogito etc.\n 'GIT_DIR'::\n \tIf the 'GIT_DIR' environment variable is set then it\n \tspecifies a path to use instead of the default `.git`\n-\tfor the base of the repository.\n+\tfor the base of the repository. Setting this to use a name\n+\tother than `.git` _inside_ the working tree is not supported.\n \n 'GIT_WORK_TREE'::\n \tSet the path to the working tree.  The value will not be\n-- \n1.5.4.4\n"},{"id":"72995","messageId":"Pine.LNX.4.64.0803250050320.30488@kaos.quantumfyre.co.uk","threadId":"12851","inReplyTo":"fs9i36$qck$1@ger.gmane.org","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2008-03-25T01:42:36Z","receivedAt":"2008-03-25T01:42:36Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n\n> * Junio C Hamano <gitster@pobox.com> wrote:\n>> Julian Phillips <julian@quantumfyre.co.uk> writes:\n>>> On Tue, 25 Mar 2008, Michael Gebetsroither wrote:\n>\n>>>> % git-add -f foo/.git/bar\n>>>> fatal: unable to add foo/.git/bar to index\n>\n>> Also it is false that we should only care about the first one.  Think\n>> submodules.\n>\n> Would it be possible to allow it with git-add -f or does that break to\n> many cases?\n\nIt would be possible, but Junio has convinced me that it wouldn't really \nbe wise.  Inside the working tree .git is a special name - end of story.\n\nIt would be relatively easy to change the check that prevents you from \ndoing it - but this wouldn't stop any of the nasty things that could \nensue.  You might never have a problem with a simple layout, but it could \ncause mayhem for others with more complicated layouts.\n\n(I've never used any of the more complicated layouts either, which is why \nI didn't initially see the problems ... ho hum)\n\n-- \nJulian\n\n  ---\nHlade's Law:\n \tIf you have a difficult task, give it to a lazy person --\n \tthey will find an easier way to do it.\n"},{"id":"73154","messageId":"fse7ot$qpl$1@ger.gmane.org","threadId":"12851","inReplyTo":"Pine.LNX.4.64.0803250050320.30488@kaos.quantumfyre.co.uk","subject":"Re: [bug] git-add won't add foo/.git/bar","fromName":"Michael Gebetsroither","fromEmail":"gebi@sbox.tugraz.at","sentAt":"2008-03-26T19:22:04Z","receivedAt":"2008-03-26T19:22:04Z","isPatch":false,"sender":{"key":"gebi@sbox.tugraz.at","avatar":"https://gravatar.com/avatar/b3168bab3f94cb1f09343b408b618ff2982aea3c20789c387f6d5c9b3b73999b?d=mp&s=160"},"body":"* Julian Phillips <julian@quantumfyre.co.uk> wrote:\n\n> It would be relatively easy to change the check that prevents you from \n> doing it - but this wouldn't stop any of the nasty things that could \n> ensue.  You might never have a problem with a simple layout, but it could \n> cause mayhem for others with more complicated layouts.\n\nfair enough, thx :)\n\ncu,\nmichael\n-- \nIt's already too late!\n"}]}