gitrepo

How can I make `repo status` gather untracked filles under the top most untracked directory?


I have a set of GIT repositories managed with the Google repo tool. Some of those repositories contain untracked directories ; not tracked yet, but still used.

When I run git status within one of those, it gives:

On branch develop
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    projects/demo_in2a/
    projects/demo_in2b/
    ...

But the repo status lists all the files like this:

project trunk/                                  branch develop
 --     projects/demo_in2a/Kbuild.mk
 --     projects/demo_in2a/Makefile
 --     projects/demo_in2a/static.c
 --     projects/demo_in2a/include/FreeRTOSConfig.h
 --     projects/demo_in2a/include/memory_pool.mdef
 --     projects/demo_in2a/include/service.h
 --     projects/demo_in2a/main.c
 --     projects/demo_in2a/defconfig
 --     projects/demo_in2a/run.py
 --     projects/demo_in2b/Kbuild.mk
 --     projects/demo_in2b/Makefile
 --     projects/demo_in2b/static.c
 --     projects/demo_in2b/include/FreeRTOSConfig.h
 --     projects/demo_in2b/include/memory_pool.mdef
 --     projects/demo_in2b/include/service.h
 --     projects/demo_in2b/main.c
 --     projects/demo_in2b/defconfig
 --     projects/demo_in2b/run.py
...

It looks like repo calls git status with the -u argument.. and it makes the overall status a bit messy and barely readable.

How can I make repo status gather untracked filles under the top most untracked directory?


Solution

  • A workaround is to use repo forall.

    repo forall -p -c 'git status -s'
    

    It runs git status -s in every repository. If a repository is not clean, it prints the path of the repository (with -p) and working tree status in the short-format.

    project path/foo
    ?? a/
    project path/bar
    ?? b/