Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Disable git for some folders/paths #154

Closed
hrvoj3e opened this issue Feb 13, 2019 · 1 comment
Closed

Disable git for some folders/paths #154

hrvoj3e opened this issue Feb 13, 2019 · 1 comment
Labels
Status: Blocked Type: Enhancement New feature or request Upstream Issue Issue also affecting upstream. May need fixing there, first.

Comments

@hrvoj3e
Copy link
Contributor

hrvoj3e commented Feb 13, 2019

Feature Request

Add and option to list regex and/or glob patterns to skip git features.

SPACEFISH_GIT_SKIP '^~/code/sshfs/' '*/sshfs/*'

I am new to this theme - don't know if it is compatible with Spaceship.

My current fix

I have mounted projects via sshfs in ~/code/sshfs/client/project/another/stuff/.
Command git status --porcelain -b never ends over sshfs (I always kill it after 3-4 minutes).

Setting set -g SPACEFISH_GIT_SHOW false helps a lot.
I still get some git info like branches (but no status).
But at least I can run ls inside dir with .git over sshfs.

What I have so far. It works for me for now.
~/.config/fish/fish_prompt_git_disable.fish

function fish_prompt_git_disable
    set -l realhome ~
    set -l dir (pwd)
    set -l gitoff n
    set -l check (string match -r '^'$realhome'/code/sshfs' "$dir")
    if test -n "$check"
        set gitoff y
    end
    ## spacefish theme
    if set -q SPACEFISH_VERSION
        if test "$gitoff" = y
            set -g SPACEFISH_GIT_SHOW false
        else
            set -g SPACEFISH_GIT_SHOW true
        end
    end
end

Call my function inside fish_prompt before setting other defaults.
~/.config/fish/fish_prompt.fish

# Store the exit code of the last command
set -g sf_exit_code $status
set -g SPACEFISH_VERSION 2.2.0
...
fish_prompt_git_disable
...
for i in $SPACEFISH_PROMPT_ORDER
	eval __sf_section_$i
end
set_color normal

Maybe I should try with removing git keyword from SPACEFISH_PROMPT_ORDER.
Which is better?

Variable SPACEFISH_GIT_STATUS_SHOW can be used instead SPACEFISH_GIT_SHOW when my pull request is accepted #155

@matchai matchai added the Type: Enhancement New feature or request label Feb 17, 2019
@matchai
Copy link
Owner

matchai commented Feb 21, 2019

Hey @hrvoj3e!

I really like the idea of having directories that would be skipped in showing the git section, however, this feature would first need to be accepted into the spaceship project to avoid having diverging feature sets.

I'll be closing this for the time being, but if an equivalent feature is ever considered for addition to spaceship, we can certainly have this feature added here as well. 😄

@matchai matchai added Upstream Issue Issue also affecting upstream. May need fixing there, first. Status: Blocked labels Feb 21, 2019
@matchai matchai closed this as completed Feb 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: Blocked Type: Enhancement New feature or request Upstream Issue Issue also affecting upstream. May need fixing there, first.
Projects
None yet
Development

No branches or pull requests

2 participants