Skip to content

Commit 1356377

Browse files
committed
scripts: git: add option for untracked files
By default 'git status' will look for untracked files and the script will always detect that the local tree has changes if untracked files are present. That is not always optimal since sometimes we might have, for example, some custom build scripts (for some project) that is always present and we don't want the status bar to always indicate changes. Hence, add an option to disable this behavior by adding the '-uno' flag to 'git status'. The default behavior is still maintained. Signed-off-by: Nuno Sá <noname.nuno@gmail.com>
1 parent 150daf3 commit 1356377

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

INSTALL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ Set symbol or message to use when the current pane has no git repo
206206
set -g @dracula-git-no-repo-message ""
207207
```
208208

209+
Hide untracked files from being displayed as local changes
210+
```bash
211+
# default is false
212+
set -g @dracula-git-no-untracked-files true
213+
```
209214

210215
#### weather options
211216

scripts/git.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ IFS=' ' read -r -a hide_status <<< $(get_tmux_option "@dracula-git-disable-statu
77
IFS=' ' read -r -a current_symbol <<< $(get_tmux_option "@dracula-git-show-current-symbol" "")
88
IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-symbol" "!")
99
IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "")
10+
IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false")
1011

1112
# Get added, modified, updated and deleted files from git status
1213
getChanges()
@@ -77,8 +78,9 @@ checkEmptySymbol()
7778
# check to see if the current repo is not up to date with HEAD
7879
checkForChanges()
7980
{
81+
[ $no_untracked_files == "false" ] && no_untracked="" || no_untracked="-uno"
8082
if [ "$(checkForGitDir)" == "true" ]; then
81-
if [ "$(git -C $path status -s)" != "" ]; then
83+
if [ "$(git -C $path status -s $no_untracked)" != "" ]; then
8284
echo "true"
8385
else
8486
echo "false"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy