git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
@ 2019-09-03 12:44 Σταύρος Ντέντος
  2019-09-03 13:34 ` Taylor Blau
  0 siblings, 1 reply; 6+ messages in thread
From: Σταύρος Ντέντος @ 2019-09-03 12:44 UTC (permalink / raw)
  To: git

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?

Ντέντος Σταύρος

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
  2019-09-03 12:44 Git does not recognise directory named '${sys:DATA_ROOT_DIR}' Σταύρος Ντέντος
@ 2019-09-03 13:34 ` Taylor Blau
  2019-09-03 14:11   ` Σταύρος Ντέντος
  2019-09-03 19:08   ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Taylor Blau @ 2019-09-03 13:34 UTC (permalink / raw)
  To: Σταύρος Ντέντος
  Cc: git

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
  2019-09-03 13:34 ` Taylor Blau
@ 2019-09-03 14:11   ` Σταύρος Ντέντος
  2019-09-03 16:45     ` Philip Oakley
  2019-09-03 19:08   ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Σταύρος Ντέντος @ 2019-09-03 14:11 UTC (permalink / raw)
  To: Taylor Blau; +Cc: git

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
  2019-09-03 14:11   ` Σταύρος Ντέντος
@ 2019-09-03 16:45     ` Philip Oakley
  0 siblings, 0 replies; 6+ messages in thread
From: Philip Oakley @ 2019-09-03 16:45 UTC (permalink / raw)
  To: Σταύρος Ντέντος,
	Taylor Blau
  Cc: git

On 03/09/2019 15:11, Σταύρος Ντέντος wrote:
> 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 :-)
Makes me wonder if git status could maybe warn about empty trees as 
'untracked'?

Philip

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
  2019-09-03 13:34 ` Taylor Blau
  2019-09-03 14:11   ` Σταύρος Ντέντος
@ 2019-09-03 19:08   ` Junio C Hamano
  2019-09-03 19:55     ` Σταύρος Ντέντος
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2019-09-03 19:08 UTC (permalink / raw)
  To: Taylor Blau
  Cc: Σταύρος Ντέντος,
	git

Taylor Blau <me@ttaylorr.com> writes:

> 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.

Hmph, I thought the common convention was to create a ".gitignore"
file in the directory with catch-all pattern, so that no matter what
cruft you had there "git add" will not add anything from it, if you
wish to keep this directory "empty".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git does not recognise directory named '${sys:DATA_ROOT_DIR}'
  2019-09-03 19:08   ` Junio C Hamano
@ 2019-09-03 19:55     ` Σταύρος Ντέντος
  0 siblings, 0 replies; 6+ messages in thread
From: Σταύρος Ντέντος @ 2019-09-03 19:55 UTC (permalink / raw)
  To: git; +Cc: Taylor Blau, Junio C Hamano, Philip Oakley

> Makes me wonder if git status could maybe warn about empty trees as 'untracked'?

Well, I "suppose" git-add could warn you that you are adding an empty
tree (and I'd like if that happened, implicit vs explicit action i.e.
ignoring).
However, I assume the no-empty-tree case was a design decision; hence,
it's been 2.2# versions without such warning.

I doubt it would be considered to be added now.


On Tue, Sep 3, 2019 at 10:08 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Taylor Blau <me@ttaylorr.com> writes:
>
> > 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.
>
> Hmph, I thought the common convention was to create a ".gitignore"
> file in the directory with catch-all pattern, so that no matter what
> cruft you had there "git add" will not add anything from it, if you
> wish to keep this directory "empty".

I believe Taylor is talking about explicitly keeping a directory
empty, that may or may not, in the future, contain files (that will be
tracked) [1].
You are infering that, regardless if there are files or will be added
in the future, you don't want to check anything in.

While [1] is a very niche corner case (and maybe it doesn't make sense
to the most of us, true), there is a "debian-equivalent" behavior
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=812223

(I cannot find the definition of this behavior, but you can see an
example usecase)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-03 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 12:44 Git does not recognise directory named '${sys:DATA_ROOT_DIR}' Σταύρος Ντέντος
2019-09-03 13:34 ` Taylor Blau
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     ` Σταύρος Ντέντος

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).