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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux