Reputation: 507
I wish to use the output from git status in a script but, because the output is always giving repo-relative file paths, other commands can't find their args. This question mentioned the relativePaths option but it has no effect on output when given as a command option:
git -c status.relativePaths=true status --short
If I've got a changed file at C:\projects\myproject\config\module\feature.src
, and I'm sitting at a command prompt in C:\projects\myproject\web\somepage
, then I'd need a path like either of these:
..\..\config\module\feature.src
C:\projects\myproject\config\module\feature.src
...to be able to hand that off to other tools that I want to invoke on newly-changed files. Instead, with the repo based in myproject\
, every combination of options I've tried has yielded only
config\module\feature.src
So how can I get actual relative paths, or even absolute paths? Am I missing something basic?
I'm using git version 1.9.4.msysgit.2 on Windows 7 with the repo files in an external folder. I can provide a List Of Things I've Tried That Didn't Work. I can have my script query and cd to the repo root before running other commands, or do it myself first, but those are just workarounds.
Upvotes: 4
Views: 8632
Reputation: 942
You need to use git config status.relativePaths true
. Read more in the configuration
section here.
Upvotes: 4