git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'

From
ΣΝΣταύρος Ντέντος <stdedos@gmail.com>
Date
Sep 3, 2019, 14:11 UTC
Message-ID
<CAHMHMxVy7Ud+pOHbfWXX4jzPoPng8TvR2zNgm_B56Srt64BrWw@mail.gmail.com>
In-Reply-To
<20190903133422.GA51158@syl.lan>
Hey Taylor,

This was happening on a (much) more massive repository; I simply tried to dumb down the example.

The original folder did had a folder structure 3 levels deep. Unfortunately, I don't remember if the leaves were files (or directories themselves). However, since I "replicated" it, I went ahead and cleaned up my main repo (sigh).

Thank you for reminding me of the empty-tree case :-)
(Reply-all missed the list)
-- 
Until next time,
Ντέντος Σταύρος

On Tue, Sep 3, 2019 at 4:34 PM Taylor Blau <me@ttaylorr.com> wrote:
>
> Hi,
>
> On Tue, Sep 03, 2019 at 03:44:14PM +0300, Σταύρος Ντέντος wrote:
> > Hello there,
> >
> > While the name is obviously a mistake, git refuses to even acknowledge
> > the directory.
> >
> > ```
> > u@h:~/$ mkdir init-test
> > u@h:~/$ cd init-test
> > u@h:~/init-test$ git init
> > Initialized empty Git repository in /home/u/init-test/.git/
> > u@h:~/init-test$ (master #) mkdir \$\{sys\:DATA_ROOT_DIR\}/
> > u@h:~/init-test$ (master #) git status
> > On branch master
> >
> > No commits yet
> >
> > nothing to commit (create/copy files and use "git add" to track)
> > u@h:~/init-test$ (master #) git add
> > .git/                    ${sys:DATA_ROOT_DIR}/
> > u@h:~/init-test$ (master #) git add \$\{sys\:DATA_ROOT_DIR\}/
> > u@h:~/init-test$ (master #) git commit --signoff -m'a'
> > On branch master
> >
> > Initial commit
> >
> > nothing to commit
> > u@h:~/init-test$ (master #)
> > ```
> >
> > Is that expected?
>
> Git does not track empty trees; that is to say 'git add' on an empty
> directory does not change the status of the index.
>
> Try for example:
>
>   $ git init repo && cd repo
>   $ mkdir -p dir
>   $ git add dir
>   $ git status
>
> And note that 'git status' says there are no changes.
>
> On the other hand, 'git add' performs fine even in a directory named
> '${sys:DATA_ROOT_DIR}'; simply create a file (even an empty one) within
> that directory and then run 'git add'. It will stage your "changes" as
> expected.
>
> If you wish to keep this directory "empty", but stored in Git, a common
> convention is to create an empty '.gitkeep' file in the directory. This
> file is not special in any way to Git, rather it serves as _a_ file to
> keep the directory non-empty.
>
> Hope this helps.
>
> > Ντέντος Σταύρος
>
> Thanks,
> Taylor
Previous: Taylor BlauNext: Philip Oakley
Message 3 of 6 in “Git does not recognise directory named '${sys:DATA_ROOT_DIR}'”
  1. Σταύρος ΝτέντοςSep 3, 2019
  2. Taylor BlauSep 3, 2019
  3. Σταύρος ΝτέντοςSep 3, 2019
  4. Philip OakleySep 3, 2019
  5. Junio C HamanoSep 3, 2019
  6. Σταύρος ΝτέντοςSep 3, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.