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

Showing + Sign and Red Background when Git working directory clean #123

Closed
LeonardoGentile opened this issue Jan 31, 2014 · 13 comments
Closed

Comments

@LeonardoGentile
Copy link

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
@banga
Copy link
Collaborator

banga commented Feb 1, 2014

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

@LeonardoGentile
Copy link
Author

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

@jknair
Copy link
Contributor

jknair commented Feb 7, 2014

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

@LeonardoGentile
Copy link
Author

yes I do indeed

@jknair
Copy link
Contributor

jknair commented Feb 7, 2014

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

@LeonardoGentile
Copy link
Author

@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

@ruturajv
Copy link

ruturajv commented Feb 9, 2014

@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

@LeonardoGentile
Copy link
Author

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 = **myemail@example.com**
[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 = git@github.com: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
Copy link
Author

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

@ruturajv
Copy link

@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.

@LeonardoGentile
Copy link
Author

@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
Copy link
Author

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

banga added a commit that referenced this issue Feb 17, 2014
adding HOME env variable, so that git respects user's configs #123
@banga
Copy link
Collaborator

banga commented Feb 17, 2014

Sweet, thanks for the report!

@banga banga closed this as completed Feb 17, 2014
amtrivedi91 added a commit to amtrivedi91/powerline-shell that referenced this issue Aug 31, 2016
amtrivedi91 added a commit to amtrivedi91/powerline-shell that referenced this issue Aug 31, 2016
adding HOME env variable, so that git respects user's configs b-ryan#123
amtrivedi91 added a commit to amtrivedi91/powerline-shell that referenced this issue Aug 31, 2016
amtrivedi91 added a commit to amtrivedi91/powerline-shell that referenced this issue Aug 31, 2016
adding HOME env variable, so that git respects user's configs b-ryan#123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants