{"thread":{"id":"28976","subject":".git ignored regardless of --git-dir value","startedAt":"2011-11-18T20:56:56Z","lastAt":"2011-11-18T23:44:03Z","messageCount":4,"participants":["Shawn Ferris","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179718","messageId":"CAC2kKA_PZNDg_dPjWXKeFU4ZVpMas3PubZfSgTnfCfVPuNPdsA@mail.gmail.com","threadId":"28976","inReplyTo":null,"subject":".git ignored regardless of --git-dir value","fromName":"Shawn Ferris","fromEmail":"shawn.ferris@gmail.com","sentAt":"2011-11-18T20:56:56Z","receivedAt":"2011-11-18T20:56:56Z","isPatch":false,"sender":{"key":"shawn.ferris@gmail.com","avatar":null},"body":"Hi All --\n\nIs it expected behavior to have the .git directory ignored, even after\nspecifying an alternate location with --git-dir? For example:\n\n$ git --git-dir=.foo init\nInitialized empty Git repository in /home/sferris/work/t/.foo/\n\n$ mkdir .git\n$ touch .git/filea\n\n$ git --git-dir=.foo --work-tree=. add .\n\n$ git --git-dir=.foo --work-tree=. status\n# On branch master\n#\n# Initial commit\n#\n# Changes to be committed:\n#   (use \"git rm --cached <file>...\" to unstage)\n#\n#    new file:   .foo/HEAD\n#    new file:   .foo/config\n#    new file:   .foo/description\n#    new file:   .foo/hooks/applypatch-msg.sample\n#    new file:   .foo/hooks/commit-msg.sample\n#    new file:   .foo/hooks/post-update.sample\n#    new file:   .foo/hooks/pre-applypatch.sample\n#    new file:   .foo/hooks/pre-commit.sample\n#    new file:   .foo/hooks/pre-rebase.sample\n#    new file:   .foo/hooks/prepare-commit-msg.sample\n#    new file:   .foo/hooks/update.sample\n#    new file:   .foo/index.lock\n#    new file:   .foo/info/exclude\n#\n# Changes not staged for commit:\n#   (use \"git add/rm <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#    deleted:    .foo/index.lock\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#    .foo/index\n#    .foo/objects/\n\nNotice that .foo was added, but .git was ignored. I would have\nexpected .foo to be ignored and .git to be added? (right, wrong or\nindifferent..)\n\nThanks for any info!\n\nShawn\n"},{"id":"179721","messageId":"7vsjlljf57.fsf@alter.siamese.dyndns.org","threadId":"28976","inReplyTo":"CAC2kKA_PZNDg_dPjWXKeFU4ZVpMas3PubZfSgTnfCfVPuNPdsA@mail.gmail.com","subject":"Re: .git ignored regardless of --git-dir value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-18T21:26:44Z","receivedAt":"2011-11-18T21:26:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Ferris <shawn.ferris@gmail.com> writes:\n\n> Is it expected behavior to have the .git directory ignored, even after\n> specifying an alternate location with --git-dir? For example:\n>\n> $ git --git-dir=.foo init\n> Initialized empty Git repository in /home/sferris/work/t/.foo/\n\nGIT_DIR and --git-dir are meant to refer to a different .git dir (or a\nbare-looking repository) located elsewhere, and not for a random pathname\nlike \".foo\". No matter what, \".git/\" anywhere is ignored from very early\ndays of Git, as Linus himself writes in the source, e.g. 8695c8b (Add\n\"show-files\" command to show the list of managed (or non-managed) files.,\n2005-04-11):\n\n ...\n * Also, we currently ignore all names starting with a dot.\n * That likely will not change. \n ...\n"},{"id":"179723","messageId":"7v7h2xjbf4.fsf@alter.siamese.dyndns.org","threadId":"28976","inReplyTo":"7vsjlljf57.fsf@alter.siamese.dyndns.org","subject":"Re: .git ignored regardless of --git-dir value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-18T22:47:11Z","receivedAt":"2011-11-18T22:47:11Z","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> Shawn Ferris <shawn.ferris@gmail.com> writes:\n>\n>> Is it expected behavior to have the .git directory ignored, even after\n>> specifying an alternate location with --git-dir? For example:\n>>\n>> $ git --git-dir=.foo init\n>> Initialized empty Git repository in /home/sferris/work/t/.foo/\n>\n> GIT_DIR and --git-dir are meant to refer to a different .git dir (or a\n> bare-looking repository) located elsewhere, and not for a random pathname\n> like \".foo\". No matter what, \".git/\" anywhere is ignored from very early\n> days of Git, as Linus himself writes in the source, e.g. 8695c8b (Add\n> \"show-files\" command to show the list of managed (or non-managed) files.,\n> 2005-04-11):\n>\n>  ...\n>  * Also, we currently ignore all names starting with a dot.\n>  * That likely will not change. \n>  ...\n\nSorry, but the above quote is wrong.  The correct one is from 453ec4b\n(libify git-ls-files directory traversal, 2006-05-16), and survives to\nthis day in dir.c:\n\n ...\n * Read a directory tree. We currently ignore anything but\n * directories, regular files and symlinks. That's because git\n * doesn't handle them at all yet. Maybe that will change some\n * day.\n *\n * Also, we ignore the name \".git\" (even if it is not a directory).\n * That likely will not change.\n ...\n\nIn other words, originally we ignored all names starting with a dot and\ndeclared that likely will not change, but then loosened the rule to let\npeople manage their .bashrc and friends. But \".git\" is still special, and\nthat likely will not change.\n"},{"id":"179725","messageId":"CAC2kKA-E4KstQCGV=gMJHFdUdzM0boc7SmZNzvSh9_OQWvHcdQ@mail.gmail.com","threadId":"28976","inReplyTo":"7v7h2xjbf4.fsf@alter.siamese.dyndns.org","subject":"Re: .git ignored regardless of --git-dir value","fromName":"Shawn Ferris","fromEmail":"shawn.ferris@gmail.com","sentAt":"2011-11-18T23:44:03Z","receivedAt":"2011-11-18T23:44:03Z","isPatch":false,"sender":{"key":"shawn.ferris@gmail.com","avatar":null},"body":"On Fri, Nov 18, 2011 at 3:47 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n\n>>\n>> GIT_DIR and --git-dir are meant to refer to a different .git dir (or a\n>> bare-looking repository) located elsewhere, and not for a random pathname\n>> like \".foo\". No matter what, \".git/\" anywhere is ignored from very early\n\nI'm extremely green to git, so please forgive if this is obvious, but,\ncould I indulge and ask what a sample use case of that would be?\n(since it's not intended for what I assumed it was) And, if the\nbehavior I expected was possible, simply, with perhaps a separate\noption, what is the likelihood a patch would be accepted? (Or am I\njust talking nonsense and should just go away) ;D\n\nThanks Again!\n\nShawn\n"}]}