On Fri, 27 Nov 2015 08:16:30 -0800 (PST)
Kurt Vermeiren <k...@kuveco.com> wrote:

> In our project we have 4 untracked files, for local development. 
> Output of *git status *:
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> sdb-batch-web/src/main/webapp/WEB-INF/jboss-web.xml
> sdb-ear/src/main/application/
> sdb-services/src/main/webapp/WEB-INF/jboss-web.xml
> sdb-web/src/main/webapp/WEB-INF/jboss-web.xml
> Note the second line, only the directory is shown. 
> Output of *git status --untracked-files *:
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> sdb-batch-web/src/main/webapp/WEB-INF/jboss-web.xml
> sdb-ear/src/main/application/META-INF/jboss-deployment-structure.xml
> sdb-services/src/main/webapp/WEB-INF/jboss-web.xml
> sdb-web/src/main/webapp/WEB-INF/jboss-web.xml
> What is the difference between both commands, our believe is the
> output should be identical.
> We are on 2.6.3, OS is Ubuntu 14.04 LTS

I'd say it behaves as documented.

What does

  ls -R sdb-ear/src/main/application/


I bet it will show a single directory "META-INF" in it,
and a single file "jboss-deployment-structure.xml" in that one, right?

Let me cite the `git status` manual page:

| -u[<mode>], --untracked-files[=<mode>]
|     Show untracked files.
|     The mode parameter is optional (defaults to all), and is
|     used to specify the handling of untracked files.
|     The possible options are:
|     ·   no - Show no untracked files.
|     ·   normal - Shows untracked files and directories.
|     ·   all - Also shows individual files in untracked
|     When -u option is not used, untracked files and
| directories are shown (i.e. the same as specifying normal), to help
| you avoid forgetting to add newly created files. Because it takes
| extra work to find untracked files in the filesystem, this mode may
| take some time in a large working tree. You can use no to have git
| status return more quickly without showing untracked files.
|     The default can be changed using the status.showUntrackedFiles
| configuration variable documented in git-config(1).

So basically when you doesn't specify the --untracked-files
command-line option, `git status` behaves as if you have passed
--untracked-files=normal and if everything is untracked in a directory,
the output is reduced to name just that directory.
When you pass --untracked-files, it gets interpreted as
--untracked-files=all, and you see the untracked files under a
completely untracked directory.

I reckon the rationale for this default behaviour is that an untracked
directory might be huge and if you won't track anything in it, there's
no point in listing all the garbage it contains.  Conversely, if you
have a directory which has some of its contents tracked, it's sensible
to show you what exactly is not tracked in there -- because most
probably it's newly created files.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to