Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Count individual files in untracked directory (--untracked-files) #53

Closed
dorian-marchal opened this issue Aug 7, 2019 · 5 comments

Comments

@dorian-marchal
Copy link

commented Aug 7, 2019

git status supports an --untracked-files option that can be used to list individual files in untracked directories.

Could a similar option be added to romkatv/gitstatus ?

Example :

mkdir /tmp/foobar

cd /tmp/foobar/

git init
# Initialized empty Git repository in /tmp/foobar/.git/

source ~/gitstatus/gitstatus.plugin.sh

gitstatus_start

mkdir foo

touch foo/bar

touch foo/baz

git status --untracked-files
# On branch master
# 
# No commits yet
# 
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
# 
# 	foo/bar
# 	foo/baz
# 
# nothing added to commit but untracked files present (use "git add" to track)

gitstatus_query

echo $VCS_STATUS_NUM_UNTRACKED
1 # ← Would be "2".

@dorian-marchal dorian-marchal changed the title Count individual files in untracked directory (--untracked-files) Request: Count individual files in untracked directory (--untracked-files) Aug 7, 2019

@romkatv

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

Is it OK for you if this is implemented as a flag of gitstatus_start rather than a flag of gitstatus_query?

P.S.

You need to call gitstatus_start -u -1 or it'll never report VCS_STATUS_NUM_UNTRACKED above 1.

@romkatv

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

By the way, gitstatus used to work just like you are asking. This really sucked because sometimes you run make in a directory, it creates a single bin subdirectory with a sprawling tree, and suddenly you have 1000000000 untracked files and Git prompt is slow to update. git status would just show bin as untracked.

@dorian-marchal

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

Is it OK for you if this is implemented as a flag of gitstatus_start rather than a flag of gitstatus_query?

It would be just fine 👍

By the way, gitstatus used to work just like you are asking. This really sucked because sometimes you run make in a directory, it creates a single bin subdirectory with a sprawling tree, and suddenly you have 1000000000 untracked files

This is not a problem for me, I always add these files to .gitignore.

You need to call gitstatus_start -u -1 or it'll never report VCS_STATUS_NUM_UNTRACKED above 1.

Thanks, I forgot to add this flag in my example.

@romkatv

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

This is not a problem for me, I always add these files to .gitignore.

Me too! Unfortunately, sometimes I have to use code written by people other than myself. The problem I described isn't uncommon if you build code from git repos.

@romkatv

This comment has been minimized.

Copy link
Owner

commented Aug 20, 2019

This is done. Pass -e to gitstatus_start to count untracked files in untracked directories the same way as git status --untracked-files.

@romkatv romkatv closed this Aug 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.