powerline-shell icon indicating copy to clipboard operation
powerline-shell copied to clipboard

Showing + Sign and Red Background when Git working directory clean

Open LeonardoGentile opened this issue 12 years ago • 13 comments

I've been working on a git repo and after some changes and pushes I always see a + (plus) sign with a red background on the git segment even tough git status tells me:

# On branch whatever
nothing to commit, working directory clean

LeonardoGentile avatar Jan 31 '14 15:01 LeonardoGentile

That's odd. The command powerline runs is git status --ignore-submodules. Can you run that and take a screenshot?

banga avatar Feb 01 '14 06:02 banga

Thank you @milkbikis. I've run both git status and git status --ignore-submodules and in both cases my working directory is clean. Take a look at the screenshot (don't mind the big blank space in the path, I've obfuscated part of it) screen shot 2014-02-01 at 12 28 16 pm

LeonardoGentile avatar Feb 01 '14 12:02 LeonardoGentile

Are u using a global gitignore ? - ~/.gitignore_global ? I'm facing a similar issue

jknair avatar Feb 07 '14 06:02 jknair

yes I do indeed

LeonardoGentile avatar Feb 07 '14 09:02 LeonardoGentile

@LeonardoGentile check the pull request I have sent across. You need to add the HOME env variable for git it to work

jknair avatar Feb 07 '14 09:02 jknair

@jknair thanks, I've tried it. I don't get the + sign anymore for clean directories but I DO still get the red background even tough the message from git status is:

# On branch whatever
nothing to commit, working directory clean

LeonardoGentile avatar Feb 07 '14 09:02 LeonardoGentile

@LeonardoGentile - Hey, could you put ur global .gitconfig, your project's .git/config and working directory's .gitignore.

It'll help to identify the problem. You can mask out relevant strings

ruturajv avatar Feb 09 '14 03:02 ruturajv

Here my gloabal .gitconfig

[core]
    quotepath = false
    excludesfile = ~/.gitignore_global
    attributesfile = ~/.gitattributes
    editor = sub -n -w
[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
[color "status"]
    added = yellow
    changed = green
    untracked = cyan
[color]
    ui = true
    diff = true
[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = diffmerge
    log = true
[mergetool "diffmerge"]
    cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
    trustExitCode = true
[user]
    name = **myname**
    email = **[email protected]**
[mergetool]
    keepBackup = true

My project/.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:MyGit/myrepo.git
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "whatever1"]
    remote = origin
    merge = refs/heads/whatever1
[branch "whatever2"]
    remote = origin
    merge = refs/heads/whatever2
[branch "whatever3"]
    remote = origin
    merge = refs/heads/whatever3
[branch "whatever4"]
    remote = origin
    merge = refs/heads/whatever4

My .gitignore_global

# Compiled Python files
*.pyc

# Folder view configuration files
.DS_Store
Desktop.ini

# Thumbnail cache files
._*
Thumbs.db

# Files that might appear on external disks
.Spotlight-V100
.Trashes

#pycharm stuff
.idea/
#
*.sublime-project
*.sublime-workspace

My working directory .gitignore

*.DS_Store
*.pyc
*.swp
.sass-cache
cms/my_project.db
cms/my_project/local_settings.py
cms/my_project/media
cms/my_project/configs
data/my_projectconfig/*
data/my_project_download/*
data/my_project_transactions/*

LeonardoGentile avatar Feb 09 '14 22:02 LeonardoGentile

FYI, after testing your solution I don't see the "top" or "bottom" arrow with the number of ahead/behind commits with respect to the remote tracked branch

LeonardoGentile avatar Feb 10 '14 10:02 LeonardoGentile

@LeonardoGentile The problem related to the repo being behind or ahead (top / bottom arrows) is probably your branch not being 'tracked'. Could u confirm that ? I had the same problem when my 'branch-tracking' was lost.

ruturajv avatar Feb 17 '14 11:02 ruturajv

@ruturajv nope, the local branches are correctly tracking remote branches, this happened after trying the @jknair solution. Reverting the @jknair solution restored the + sign and shows the correct numbers of ahed/behind commits of remote branches. So I'm back to the first problem: always having the red background and the + sign in clean working directories...

LeonardoGentile avatar Feb 17 '14 11:02 LeonardoGentile

Being an idiot I haven't seen @jknair second commit that fixed a typo for pull reqest #126 . Applying it seems to solve all my issues, I'm gonna test it for a while, sorry for wasting your time

LeonardoGentile avatar Feb 17 '14 11:02 LeonardoGentile

Sweet, thanks for the report!

banga avatar Feb 17 '14 12:02 banga