Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tone Kastlunger <users.giulietta@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Path differences between git status & git status --porcelain
Date: Sat, 26 Mar 2022 17:47:47 -0700	[thread overview]
Message-ID: <xmqqzglc5ih8.fsf@gitster.g> (raw)
In-Reply-To: <CAHCc5YXmegAV-sSpLLpY19rXhnxYEgM+RzZHJ=saG8nD5HsGKg@mail.gmail.com> (Tone Kastlunger's message of "Sat, 26 Mar 2022 11:25:30 +0200")

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






  reply	other threads:[~2022-03-27  0:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26  9:25 Path differences between git status & git status --porcelain Tone Kastlunger
2022-03-27  0:47 ` Junio C Hamano [this message]
2022-03-27 16:06   ` Tone Kastlunger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzglc5ih8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=users.giulietta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox