albemuth
albemuth

Reputation: 587

Why does git status for a particular repo return paths relative to the root instead of the current directory?

When using git from a subdirectory inside a particular repo the paths of the files are returned relative to the root, like so

cd $REPO_ROOT/subdir
git status
...
#   modified ../subdir/file.txt

This behaviour is recent, it used to return file.txt instead, just as is does with my other git repos and it's messing up other features, git blame file.txt from the subdirectory returns every line as Not Yet committed, to get the actual output I need to use ../subdir/file.txt. This is also messing up the vim git plugin so I'm quite annoyed.

I have already run git gc but the problem persists.

edit: adding git version and configs

git version 1.7.4.4

user.name=...
user.email=...
github.user=...
color.branch=auto
color.diff=auto
color.status=auto
color.branch.current=yellow reverse
color.branch.local=yellow
color.branch.remote=green
color.diff.meta=yellow bold
color.diff.frag=magenta bold
color.diff.old=red
color.diff.new=green
color.status.added=green
color.status.changed=red
color.status.untracked=cyan

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true

#remotes and branches 

status.relativepaths=true

Upvotes: 2

Views: 275

Answers (1)

Ruslan Osipov
Ruslan Osipov

Reputation: 5843

It is a configuration issue:

cd repo
git config status.relativePaths true

Or global:

git config --global status.relativePaths true

Further reading: https://www.kernel.org/pub/software/scm/git/docs/git-status.html

Upvotes: 4

Related Questions