{"thread":{"id":"57619","subject":"Path differences between git status & git status --porcelain","startedAt":"2022-03-26T09:25:50Z","lastAt":"2022-03-27T16:06:22Z","messageCount":3,"participants":["Tone Kastlunger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"452406","messageId":"CAHCc5YXmegAV-sSpLLpY19rXhnxYEgM+RzZHJ=saG8nD5HsGKg@mail.gmail.com","threadId":"57619","inReplyTo":null,"subject":"Path differences between git status & git status --porcelain","fromName":"Tone Kastlunger","fromEmail":"users.giulietta@gmail.com","sentAt":"2022-03-26T09:25:30Z","receivedAt":"2022-03-26T09:25:50Z","isPatch":false,"sender":{"key":"users.giulietta@gmail.com","avatar":null},"body":"Hello;\nwe have noticed that the results displayed by git status & git status\n--porcelain differ\nin the path information shown. For instance, in one of our test repos:\n\n\"git status\" output from a \"<gitreporoot>/test\" folder:\n\n  Changes not staged for commit:\n    (use \"git add <file>...\" to update what will be committed)\n    (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n  modified:   ../src/api/db.py  <---- Notice the \"..\" correctly\ndisplaying the relative path\n       to the (modified) file\n\n\"git status --porcelain\"  output from the same location:\n\n    ....cutted stuff to keep things clean...\n       M src/api/db.py   <---- Notice the missing \"..\" in front of the\n(modified) file path.\n\nIs this intentional/expected behaviour; and if not, we were wondering\nif this is a known issue?\n\nBest,\nTone Kastlunger\nGiulietta SW\n"},{"id":"452423","messageId":"xmqqzglc5ih8.fsf@gitster.g","threadId":"57619","inReplyTo":"CAHCc5YXmegAV-sSpLLpY19rXhnxYEgM+RzZHJ=saG8nD5HsGKg@mail.gmail.com","subject":"Re: Path differences between git status & git status --porcelain","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-27T00:47:47Z","receivedAt":"2022-03-27T00:47:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tone Kastlunger <users.giulietta@gmail.com> writes:\n\n> \"git status --porcelain\"  output from the same location:\n>\n>     ....cutted stuff to keep things clean...\n>        M src/api/db.py   <---- Notice the missing \"..\" in front of the\n> (modified) file path.\n>\n> Is this intentional/expected behaviour; and if not, we were wondering\n> if this is a known issue?\n\nYes, this is working as designed and any future versions of Git will\nnot change it.  Scripts can forever rely on the fact that it can get\npaths relative to the root of the working tree regardless of where\nin the working tree they start.\n\nYou can add this:\n\n    [status]\n\trelativepaths=no\n\nto your ~/.gitconfig and \"git status\" (without --porcelain option)\nwill also show paths relative to the root of the working tree\n(i.e. without ugly ../ prefix).\n\nWe made --porcelain=v2 to get affected by the status.relativepaths\nconfiguration, which may probably have been a mistake, but that is\nalso too late to fix now.  It defaults to show paths relative to the\ndirectory the command happened to be run, and in order to get a\nreliable output, the calling script must override status.relativepaths\nconfiguration variable the end-user may have, e.g.\n\n    git -c status.relativepaths=no status --porcelain=v2\n\n\n\n\n\n"},{"id":"452438","messageId":"CAHCc5YV2Bn5NOfZvdSu6c=nERizmKrPbmGoFWkB=T58BjQ=9UQ@mail.gmail.com","threadId":"57619","inReplyTo":"xmqqzglc5ih8.fsf@gitster.g","subject":"Re: Path differences between git status & git status --porcelain","fromName":"Tone Kastlunger","fromEmail":"users.giulietta@gmail.com","sentAt":"2022-03-27T16:06:05Z","receivedAt":"2022-03-27T16:06:22Z","isPatch":false,"sender":{"key":"users.giulietta@gmail.com","avatar":null},"body":"Oh Sorry,\nthe --porcelain=v2 went by unnoticed (not mentioned in the docs).\n\nThanks for the clarification!\nBest,\ntk\n\nOn Sun, Mar 27, 2022 at 2:47 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Tone Kastlunger <users.giulietta@gmail.com> writes:\n>\n> > \"git status --porcelain\"  output from the same location:\n> >\n> >     ....cutted stuff to keep things clean...\n> >        M src/api/db.py   <---- Notice the missing \"..\" in front of the\n> > (modified) file path.\n> >\n> > Is this intentional/expected behaviour; and if not, we were wondering\n> > if this is a known issue?\n>\n> Yes, this is working as designed and any future versions of Git will\n> not change it.  Scripts can forever rely on the fact that it can get\n> paths relative to the root of the working tree regardless of where\n> in the working tree they start.\n>\n> You can add this:\n>\n>     [status]\n>         relativepaths=no\n>\n> to your ~/.gitconfig and \"git status\" (without --porcelain option)\n> will also show paths relative to the root of the working tree\n> (i.e. without ugly ../ prefix).\n>\n> We made --porcelain=v2 to get affected by the status.relativepaths\n> configuration, which may probably have been a mistake, but that is\n> also too late to fix now.  It defaults to show paths relative to the\n> directory the command happened to be run, and in order to get a\n> reliable output, the calling script must override status.relativepaths\n> configuration variable the end-user may have, e.g.\n>\n>     git -c status.relativepaths=no status --porcelain=v2\n>\n>\n>\n>\n>\n"}]}