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>
This commit is contained in:
parent
150daf31e1
commit
135637745d
2 changed files with 8 additions and 1 deletions
|
@ -206,6 +206,11 @@ Set symbol or message to use when the current pane has no git repo
|
||||||
set -g @dracula-git-no-repo-message ""
|
set -g @dracula-git-no-repo-message ""
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Hide untracked files from being displayed as local changes
|
||||||
|
```bash
|
||||||
|
# default is false
|
||||||
|
set -g @dracula-git-no-untracked-files true
|
||||||
|
```
|
||||||
|
|
||||||
#### weather options
|
#### weather options
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ IFS=' ' read -r -a hide_status <<< $(get_tmux_option "@dracula-git-disable-statu
|
||||||
IFS=' ' read -r -a current_symbol <<< $(get_tmux_option "@dracula-git-show-current-symbol" "✓")
|
IFS=' ' read -r -a current_symbol <<< $(get_tmux_option "@dracula-git-show-current-symbol" "✓")
|
||||||
IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-symbol" "!")
|
IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-symbol" "!")
|
||||||
IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "")
|
IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "")
|
||||||
|
IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false")
|
||||||
|
|
||||||
# Get added, modified, updated and deleted files from git status
|
# Get added, modified, updated and deleted files from git status
|
||||||
getChanges()
|
getChanges()
|
||||||
|
@ -77,8 +78,9 @@ checkEmptySymbol()
|
||||||
# check to see if the current repo is not up to date with HEAD
|
# check to see if the current repo is not up to date with HEAD
|
||||||
checkForChanges()
|
checkForChanges()
|
||||||
{
|
{
|
||||||
|
[ $no_untracked_files == "false" ] && no_untracked="" || no_untracked="-uno"
|
||||||
if [ "$(checkForGitDir)" == "true" ]; then
|
if [ "$(checkForGitDir)" == "true" ]; then
|
||||||
if [ "$(git -C $path status -s)" != "" ]; then
|
if [ "$(git -C $path status -s $no_untracked)" != "" ]; then
|
||||||
echo "true"
|
echo "true"
|
||||||
else
|
else
|
||||||
echo "false"
|
echo "false"
|
||||||
|
|
Loading…
Reference in a new issue