* Path differences between git status & git status --porcelain
@ 2022-03-26 9:25 Tone Kastlunger
2022-03-27 0:47 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Tone Kastlunger @ 2022-03-26 9:25 UTC (permalink / raw)
To: git
Hello;
we have noticed that the results displayed by git status & git status
--porcelain differ
in the path information shown. For instance, in one of our test repos:
"git status" output from a "<gitreporoot>/test" folder:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../src/api/db.py <---- Notice the ".." correctly
displaying the relative path
to the (modified) file
"git status --porcelain" output from the same location:
....cutted stuff to keep things clean...
M src/api/db.py <---- Notice the missing ".." in front of the
(modified) file path.
Is this intentional/expected behaviour; and if not, we were wondering
if this is a known issue?
Best,
Tone Kastlunger
Giulietta SW
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Path differences between git status & git status --porcelain
2022-03-26 9:25 Path differences between git status & git status --porcelain Tone Kastlunger
@ 2022-03-27 0:47 ` Junio C Hamano
2022-03-27 16:06 ` Tone Kastlunger
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2022-03-27 0:47 UTC (permalink / raw)
To: Tone Kastlunger; +Cc: git
Tone Kastlunger <users.giulietta@gmail.com> writes:
> "git status --porcelain" output from the same location:
>
> ....cutted stuff to keep things clean...
> M src/api/db.py <---- Notice the missing ".." in front of the
> (modified) file path.
>
> Is this intentional/expected behaviour; and if not, we were wondering
> if this is a known issue?
Yes, this is working as designed and any future versions of Git will
not change it. Scripts can forever rely on the fact that it can get
paths relative to the root of the working tree regardless of where
in the working tree they start.
You can add this:
[status]
relativepaths=no
to your ~/.gitconfig and "git status" (without --porcelain option)
will also show paths relative to the root of the working tree
(i.e. without ugly ../ prefix).
We made --porcelain=v2 to get affected by the status.relativepaths
configuration, which may probably have been a mistake, but that is
also too late to fix now. It defaults to show paths relative to the
directory the command happened to be run, and in order to get a
reliable output, the calling script must override status.relativepaths
configuration variable the end-user may have, e.g.
git -c status.relativepaths=no status --porcelain=v2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Path differences between git status & git status --porcelain
2022-03-27 0:47 ` Junio C Hamano
@ 2022-03-27 16:06 ` Tone Kastlunger
0 siblings, 0 replies; 3+ messages in thread
From: Tone Kastlunger @ 2022-03-27 16:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Oh Sorry,
the --porcelain=v2 went by unnoticed (not mentioned in the docs).
Thanks for the clarification!
Best,
tk
On Sun, Mar 27, 2022 at 2:47 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Tone Kastlunger <users.giulietta@gmail.com> writes:
>
> > "git status --porcelain" output from the same location:
> >
> > ....cutted stuff to keep things clean...
> > M src/api/db.py <---- Notice the missing ".." in front of the
> > (modified) file path.
> >
> > Is this intentional/expected behaviour; and if not, we were wondering
> > if this is a known issue?
>
> Yes, this is working as designed and any future versions of Git will
> not change it. Scripts can forever rely on the fact that it can get
> paths relative to the root of the working tree regardless of where
> in the working tree they start.
>
> You can add this:
>
> [status]
> relativepaths=no
>
> to your ~/.gitconfig and "git status" (without --porcelain option)
> will also show paths relative to the root of the working tree
> (i.e. without ugly ../ prefix).
>
> We made --porcelain=v2 to get affected by the status.relativepaths
> configuration, which may probably have been a mistake, but that is
> also too late to fix now. It defaults to show paths relative to the
> directory the command happened to be run, and in order to get a
> reliable output, the calling script must override status.relativepaths
> configuration variable the end-user may have, e.g.
>
> git -c status.relativepaths=no status --porcelain=v2
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-27 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-26 9:25 Path differences between git status & git status --porcelain Tone Kastlunger
2022-03-27 0:47 ` Junio C Hamano
2022-03-27 16:06 ` Tone Kastlunger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox