git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: "Σταύρος Ντέντος" <stdedos@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
Date: Tue, 3 Sep 2019 09:34:22 -0400	[thread overview]
Message-ID: <20190903133422.GA51158@syl.lan> (raw)
In-Reply-To: <CAHMHMxW4-6AZEDaJU8KOy2kRSLXjdC_RTH528=nnhVLXh=ADUA@mail.gmail.com>

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

  reply	other threads:[~2019-09-03 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 12:44 Git does not recognise directory named '${sys:DATA_ROOT_DIR}' Σταύρος Ντέντος
2019-09-03 13:34 ` Taylor Blau [this message]
2019-09-03 14:11   ` Σταύρος Ντέντος
2019-09-03 16:45     ` Philip Oakley
2019-09-03 19:08   ` Junio C Hamano
2019-09-03 19:55     ` Σταύρος Ντέντος

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190903133422.GA51158@syl.lan \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=stdedos@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).