{"thread":{"id":"51793","subject":"Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","startedAt":"2019-09-03T12:44:53Z","lastAt":"2019-09-03T19:56:08Z","messageCount":6,"participants":["Σταύρος Ντέντος","Taylor Blau","Philip Oakley","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"381717","messageId":"CAHMHMxW4-6AZEDaJU8KOy2kRSLXjdC_RTH528=nnhVLXh=ADUA@mail.gmail.com","threadId":"51793","inReplyTo":null,"subject":"Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Σταύρος Ντέντος","fromEmail":"stdedos@gmail.com","sentAt":"2019-09-03T12:44:14Z","receivedAt":"2019-09-03T12:44:53Z","isPatch":false,"sender":{"key":"stdedos@gmail.com","avatar":null},"body":"Hello there,\n\nWhile the name is obviously a mistake, git refuses to even acknowledge\nthe directory.\n\n```\nu@h:~/$ mkdir init-test\nu@h:~/$ cd init-test\nu@h:~/init-test$ git init\nInitialized empty Git repository in /home/u/init-test/.git/\nu@h:~/init-test$ (master #) mkdir \\$\\{sys\\:DATA_ROOT_DIR\\}/\nu@h:~/init-test$ (master #) git status\nOn branch master\n\nNo commits yet\n\nnothing to commit (create/copy files and use \"git add\" to track)\nu@h:~/init-test$ (master #) git add\n.git/                    ${sys:DATA_ROOT_DIR}/\nu@h:~/init-test$ (master #) git add \\$\\{sys\\:DATA_ROOT_DIR\\}/\nu@h:~/init-test$ (master #) git commit --signoff -m'a'\nOn branch master\n\nInitial commit\n\nnothing to commit\nu@h:~/init-test$ (master #)\n```\n\nIs that expected?\n\nΝτέντος Σταύρος\n"},{"id":"381721","messageId":"20190903133422.GA51158@syl.lan","threadId":"51793","inReplyTo":"CAHMHMxW4-6AZEDaJU8KOy2kRSLXjdC_RTH528=nnhVLXh=ADUA@mail.gmail.com","subject":"Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2019-09-03T13:34:22Z","receivedAt":"2019-09-03T13:34:26Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"Hi,\n\nOn Tue, Sep 03, 2019 at 03:44:14PM +0300, Σταύρος Ντέντος wrote:\n> Hello there,\n>\n> While the name is obviously a mistake, git refuses to even acknowledge\n> the directory.\n>\n> ```\n> u@h:~/$ mkdir init-test\n> u@h:~/$ cd init-test\n> u@h:~/init-test$ git init\n> Initialized empty Git repository in /home/u/init-test/.git/\n> u@h:~/init-test$ (master #) mkdir \\$\\{sys\\:DATA_ROOT_DIR\\}/\n> u@h:~/init-test$ (master #) git status\n> On branch master\n>\n> No commits yet\n>\n> nothing to commit (create/copy files and use \"git add\" to track)\n> u@h:~/init-test$ (master #) git add\n> .git/                    ${sys:DATA_ROOT_DIR}/\n> u@h:~/init-test$ (master #) git add \\$\\{sys\\:DATA_ROOT_DIR\\}/\n> u@h:~/init-test$ (master #) git commit --signoff -m'a'\n> On branch master\n>\n> Initial commit\n>\n> nothing to commit\n> u@h:~/init-test$ (master #)\n> ```\n>\n> Is that expected?\n\nGit does not track empty trees; that is to say 'git add' on an empty\ndirectory does not change the status of the index.\n\nTry for example:\n\n  $ git init repo && cd repo\n  $ mkdir -p dir\n  $ git add dir\n  $ git status\n\nAnd note that 'git status' says there are no changes.\n\nOn the other hand, 'git add' performs fine even in a directory named\n'${sys:DATA_ROOT_DIR}'; simply create a file (even an empty one) within\nthat directory and then run 'git add'. It will stage your \"changes\" as\nexpected.\n\nIf you wish to keep this directory \"empty\", but stored in Git, a common\nconvention is to create an empty '.gitkeep' file in the directory. This\nfile is not special in any way to Git, rather it serves as _a_ file to\nkeep the directory non-empty.\n\nHope this helps.\n\n> Ντέντος Σταύρος\n\nThanks,\nTaylor\n"},{"id":"381724","messageId":"CAHMHMxVy7Ud+pOHbfWXX4jzPoPng8TvR2zNgm_B56Srt64BrWw@mail.gmail.com","threadId":"51793","inReplyTo":"20190903133422.GA51158@syl.lan","subject":"Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Σταύρος Ντέντος","fromEmail":"stdedos@gmail.com","sentAt":"2019-09-03T14:11:38Z","receivedAt":"2019-09-03T14:12:17Z","isPatch":false,"sender":{"key":"stdedos@gmail.com","avatar":null},"body":"Hey Taylor,\n\nThis was happening on a (much) more massive repository; I simply tried\nto dumb down the example.\n\nThe original folder did had a folder structure 3 levels deep.\nUnfortunately, I don't remember if the leaves were files (or\ndirectories themselves). However, since I \"replicated\" it, I went\nahead and cleaned up my main repo (sigh).\n\nThank you for reminding me of the empty-tree case :-)\n\n(Reply-all missed the list)\n-- \nUntil next time,\nΝτέντος Σταύρος\n\nOn Tue, Sep 3, 2019 at 4:34 PM Taylor Blau <me@ttaylorr.com> wrote:\n>\n> Hi,\n>\n> On Tue, Sep 03, 2019 at 03:44:14PM +0300, Σταύρος Ντέντος wrote:\n> > Hello there,\n> >\n> > While the name is obviously a mistake, git refuses to even acknowledge\n> > the directory.\n> >\n> > ```\n> > u@h:~/$ mkdir init-test\n> > u@h:~/$ cd init-test\n> > u@h:~/init-test$ git init\n> > Initialized empty Git repository in /home/u/init-test/.git/\n> > u@h:~/init-test$ (master #) mkdir \\$\\{sys\\:DATA_ROOT_DIR\\}/\n> > u@h:~/init-test$ (master #) git status\n> > On branch master\n> >\n> > No commits yet\n> >\n> > nothing to commit (create/copy files and use \"git add\" to track)\n> > u@h:~/init-test$ (master #) git add\n> > .git/                    ${sys:DATA_ROOT_DIR}/\n> > u@h:~/init-test$ (master #) git add \\$\\{sys\\:DATA_ROOT_DIR\\}/\n> > u@h:~/init-test$ (master #) git commit --signoff -m'a'\n> > On branch master\n> >\n> > Initial commit\n> >\n> > nothing to commit\n> > u@h:~/init-test$ (master #)\n> > ```\n> >\n> > Is that expected?\n>\n> Git does not track empty trees; that is to say 'git add' on an empty\n> directory does not change the status of the index.\n>\n> Try for example:\n>\n>   $ git init repo && cd repo\n>   $ mkdir -p dir\n>   $ git add dir\n>   $ git status\n>\n> And note that 'git status' says there are no changes.\n>\n> On the other hand, 'git add' performs fine even in a directory named\n> '${sys:DATA_ROOT_DIR}'; simply create a file (even an empty one) within\n> that directory and then run 'git add'. It will stage your \"changes\" as\n> expected.\n>\n> If you wish to keep this directory \"empty\", but stored in Git, a common\n> convention is to create an empty '.gitkeep' file in the directory. This\n> file is not special in any way to Git, rather it serves as _a_ file to\n> keep the directory non-empty.\n>\n> Hope this helps.\n>\n> > Ντέντος Σταύρος\n>\n> Thanks,\n> Taylor\n"},{"id":"381732","messageId":"13fcde6c-e373-718f-85ea-400824052494@iee.email","threadId":"51793","inReplyTo":"CAHMHMxVy7Ud+pOHbfWXX4jzPoPng8TvR2zNgm_B56Srt64BrWw@mail.gmail.com","subject":"Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2019-09-03T16:45:28Z","receivedAt":"2019-09-03T16:45:37Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 03/09/2019 15:11, Σταύρος Ντέντος wrote:\n> The original folder did had a folder structure 3 levels deep.\n> Unfortunately, I don't remember if the leaves were files (or\n> directories themselves). However, since I \"replicated\" it, I went\n> ahead and cleaned up my main repo (sigh).\n>\n> Thank you for reminding me of the empty-tree case :-)\nMakes me wonder if git status could maybe warn about empty trees as \n'untracked'?\n\nPhilip\n"},{"id":"381758","messageId":"xmqqa7bltcyu.fsf@gitster-ct.c.googlers.com","threadId":"51793","inReplyTo":"20190903133422.GA51158@syl.lan","subject":"Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-09-03T19:08:09Z","receivedAt":"2019-09-03T19:08:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Taylor Blau <me@ttaylorr.com> writes:\n\n> If you wish to keep this directory \"empty\", but stored in Git, a common\n> convention is to create an empty '.gitkeep' file in the directory. This\n> file is not special in any way to Git, rather it serves as _a_ file to\n> keep the directory non-empty.\n\nHmph, I thought the common convention was to create a \".gitignore\"\nfile in the directory with catch-all pattern, so that no matter what\ncruft you had there \"git add\" will not add anything from it, if you\nwish to keep this directory \"empty\".\n"},{"id":"381766","messageId":"CAHMHMxX192aM5owHjvi3s06ZykcQAHsVneBsfv9YvbeYM-XTXA@mail.gmail.com","threadId":"51793","inReplyTo":"xmqqa7bltcyu.fsf@gitster-ct.c.googlers.com","subject":"Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'","fromName":"Σταύρος Ντέντος","fromEmail":"stdedos@gmail.com","sentAt":"2019-09-03T19:55:25Z","receivedAt":"2019-09-03T19:56:08Z","isPatch":false,"sender":{"key":"stdedos@gmail.com","avatar":null},"body":"> Makes me wonder if git status could maybe warn about empty trees as 'untracked'?\n\nWell, I \"suppose\" git-add could warn you that you are adding an empty\ntree (and I'd like if that happened, implicit vs explicit action i.e.\nignoring).\nHowever, I assume the no-empty-tree case was a design decision; hence,\nit's been 2.2# versions without such warning.\n\nI doubt it would be considered to be added now.\n\n\nOn Tue, Sep 3, 2019 at 10:08 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Taylor Blau <me@ttaylorr.com> writes:\n>\n> > If you wish to keep this directory \"empty\", but stored in Git, a common\n> > convention is to create an empty '.gitkeep' file in the directory. This\n> > file is not special in any way to Git, rather it serves as _a_ file to\n> > keep the directory non-empty.\n>\n> Hmph, I thought the common convention was to create a \".gitignore\"\n> file in the directory with catch-all pattern, so that no matter what\n> cruft you had there \"git add\" will not add anything from it, if you\n> wish to keep this directory \"empty\".\n\nI believe Taylor is talking about explicitly keeping a directory\nempty, that may or may not, in the future, contain files (that will be\ntracked) [1].\nYou are infering that, regardless if there are files or will be added\nin the future, you don't want to check anything in.\n\nWhile [1] is a very niche corner case (and maybe it doesn't make sense\nto the most of us, true), there is a \"debian-equivalent\" behavior\nhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=812223\n\n(I cannot find the definition of this behavior, but you can see an\nexample usecase)\n"}]}