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

Incorrect number of untracked files (`$VCS_STATUS_NUM_UNTRACKED`) #41

Closed
dorian-marchal opened this issue Jul 5, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@dorian-marchal
Copy link

commented Jul 5, 2019

In this example, git status reports 2 untracked files, but echo $VCS_STATUS_NUM_UNTRACKED returns 1:

cd /tmp

mkdir test-repo

cd test-repo/

git init
# Initialized empty Git repository in /tmp/test-repo/.git/

git commit --allow-empty -m 'Initial commit'
# [master (root-commit) b81f127] Initial commit

touch a

touch b

git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# 	a
# 	b
# nothing added to commit but untracked files present (use "git add" to track)

source ~/gitstatus/gitstatus.plugin.sh

gitstatus_query

echo $VCS_STATUS_NUM_UNTRACKED
1
@romkatv

This comment has been minimized.

Copy link
Owner

commented Jul 5, 2019

This is WAI.

Form https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.sh:

# Starts gitstatusd in the background. Does nothing and succeeds if gitstatusd
# is already running.
#
# Usage: gitstatus_start [OPTION]...
#
#   -t FLOAT  Fail the self-check on initialization if not getting a response from
#             gitstatusd for this this many seconds. Defaults to 5.
#
#   -s INT    Report at most this many staged changes; negative value means infinity.
#             Defaults to 1.
#
#   -u INT    Report at most this many unstaged changes; negative value means infinity.
#             Defaults to 1.
#
#   -d INT    Report at most this many untracked files; negative value means infinity.
#             Defaults to 1.
#
#   -m INT    Report -1 unstaged and untracked if there are more than this many files
#             in the index. Negative value means infinity. Defaults to -1.
function gitstatus_start()

If you need counters, you need to pass -s 99 -u 99 -d 99 to gitstatus_start. It's OK to use -1 with -s and -u but it's dangerous to do that with -d. 99 works well. When you see 99 in your prompt, you'll know you have many changes.

@dorian-marchal

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

OK, thanks I didn't know that. 👍

Can't get it to work, though:

$ gitstatus_start -d 99
/bin/bash: illegal option -- d

@romkatv romkatv closed this in 9bbf75b Jul 5, 2019

@romkatv

This comment has been minimized.

Copy link
Owner

commented Jul 5, 2019

Oops. Should be fixed now.

@dorian-marchal

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

Fixed indeed, thanks! ❤️

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