{"thread":{"id":"55519","subject":"[PATCH] doc: clarify the filename encoding in git diff","startedAt":"2021-04-19T13:30:29Z","lastAt":"2021-04-20T11:24:43Z","messageCount":3,"participants":["Andrey Bienkowski via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"422313","messageId":"pull.996.git.git.1618838856399.gitgitgadget@gmail.com","threadId":"55519","inReplyTo":null,"subject":"[PATCH] doc: clarify the filename encoding in git diff","fromName":"Andrey Bienkowski via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-04-19T13:27:35Z","receivedAt":"2021-04-19T13:30:29Z","isPatch":true,"sender":{"key":"hexagonrecursion@gmail.com","avatar":"https://avatars.githubusercontent.com/u/52621858?v=4"},"body":"From: Andrey Bienkowski <hexagonrecursion@gmail.com>\n\nAFAICT parsing the output of `git diff --name-only master...feature`\nis the intended way of programmatically getting the list of files modified\nby a feature branch. It is impossible to parse text unless you know what\nencoding it is in. The output encoding of diff --name-only and\ndiff --name-status was not documented.\n\nI asked on the mailing list and got this:\nhttps://public-inbox.org/git/YGx2EMHnwXWbp4ET@coredump.intra.peff.net/\n> There's some discussion in Documentation/i18n.txt, which is included in\nvarious manpages (e.g., https://git-scm.com/docs/git-log#_discussion)\nbut it doesn't seem to be mentioned in git-diff.\n>\nThe short answer is: mostly utf8, but historically on platforms that\ndon't care (like Linux) you could get away with other encodings.\n>\n-Peff\n\nMy takeaway was to always parse it as utf8 regardless of platform or\nenvironment.\n\nSigned-off-by: Andrey Bienkowski <hexagonrecursion@gmail.com>\n---\n    doc: clarify the filename encoding in git diff --name-only and\n    --name-status\n    \n    AFAICT parsing the output of git diff --name-only master...feature is\n    the intended way of programmatically getting the list of files modified\n    by a feature branch. It is impossible to parse text unless you know what\n    encoding it is in. The output encoding of diff --name-only and diff\n    --name-status was not documented.\n    \n    I asked on the mailing list and got this:\n    https://public-inbox.org/git/YGx2EMHnwXWbp4ET@coredump.intra.peff.net/\n    \n    > There's some discussion in Documentation/i18n.txt, which is included\n    > in various manpages (e.g.,\n    > https://git-scm.com/docs/git-log#_discussion) but it doesn't seem to\n    > be mentioned in git-diff.\n    >\n    > The short answer is: mostly utf8, but historically on platforms that\n    > don't care (like Linux) you could get away with other encodings.\n    >\n    > -Peff\n    \n    My takeaway was to always parse it as utf8 regardless of platform or\n    environment.\n    \n    Changes since v1:\n    \n     * Replace \"always\" with \"often\"\n     * Add a link to https://git-scm.com/docs/git-log\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-996%2Fhexagonrecursion%2Futf8-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-996/hexagonrecursion/utf8-v1\nPull-Request: https://github.com/git/git/pull/996\n\n Documentation/diff-options.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex aa2b5c11f20b..4ce36ef535ba 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -293,11 +293,14 @@ explained for the configuration variable `core.quotePath` (see\n linkgit:git-config[1]).\n \n --name-only::\n-\tShow only names of changed files.\n+\tShow only names of changed files. The file names are usually encoded in UTF-8.\n+\tFor more information see the discussion about encoding in the linkgit:git-log[1]\n+\tmanual page.\n \n --name-status::\n \tShow only names and status of changed files. See the description\n \tof the `--diff-filter` option on what the status letters mean.\n+\tJust like `--name-only` the file names are usually encoded in UTF-8.\n \n --submodule[=<format>]::\n \tSpecify how differences in submodules are shown.  When specifying\n\nbase-commit: 48bf2fa8bad054d66bd79c6ba903c89c704201f7\n-- \ngitgitgadget\n"},{"id":"422342","messageId":"xmqqwnsy7ydd.fsf@gitster.g","threadId":"55519","inReplyTo":"pull.996.git.git.1618838856399.gitgitgadget@gmail.com","subject":"Re: [PATCH] doc: clarify the filename encoding in git diff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-19T21:33:50Z","receivedAt":"2021-04-19T21:33:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Andrey Bienkowski via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> Signed-off-by: Andrey Bienkowski <hexagonrecursion@gmail.com>\n> ---\n>     My takeaway was to always parse it as utf8 regardless of platform or\n>     environment.\n>     \n>     Changes since v1:\n\nI do not think the readers on the list have seen the \"v1\", but\nanyway, the \n\n>      * Replace \"always\" with \"often\"\n\n\"often\" here sound more measured than ...\n\n>  --name-only::\n> -\tShow only names of changed files.\n> +\tShow only names of changed files. The file names are usually encoded in UTF-8.\n> +\tFor more information see the discussion about encoding in the linkgit:git-log[1]\n> +\tmanual page.\n\n... \"usually\" here ...\n\n>  --name-status::\n>  \tShow only names and status of changed files. See the description\n>  \tof the `--diff-filter` option on what the status letters mean.\n> +\tJust like `--name-only` the file names are usually encoded in UTF-8.\n\n... and here.\n\nThanks.\n"},{"id":"422385","messageId":"pull.996.v2.git.git.1618917877881.gitgitgadget@gmail.com","threadId":"55519","inReplyTo":"pull.996.git.git.1618838856399.gitgitgadget@gmail.com","subject":"[PATCH v2] doc: clarify the filename encoding in git diff","fromName":"Andrey Bienkowski via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-04-20T11:24:37Z","receivedAt":"2021-04-20T11:24:43Z","isPatch":true,"sender":{"key":"hexagonrecursion@gmail.com","avatar":"https://avatars.githubusercontent.com/u/52621858?v=4"},"body":"From: Andrey Bienkowski <hexagonrecursion@gmail.com>\n\nAFAICT parsing the output of `git diff --name-only master...feature`\nis the intended way of programmatically getting the list of files\nmodified\nby a feature branch. It is impossible to parse text unless you know what\nencoding it is in. The output encoding of diff --name-only and\ndiff --name-status was not documented.\n\nI asked on the mailing list and got this:\nhttps://public-inbox.org/git/YGx2EMHnwXWbp4ET@coredump.intra.peff.net/\n> There's some discussion in Documentation/i18n.txt, which is included\nin\nvarious manpages (e.g., https://git-scm.com/docs/git-log#_discussion)\nbut it doesn't seem to be mentioned in git-diff.\n>\nThe short answer is: mostly utf8, but historically on platforms that\ndon't care (like Linux) you could get away with other encodings.\n>\n-Peff\n\nMy takeaway was to always parse it as utf8 regardless of platform or\nenvironment.\n\nSigned-off-by: Andrey Bienkowski <hexagonrecursion@gmail.com>\n---\n    doc: clarify the filename encoding in git diff --name-only and\n    --name-status\n    \n    AFAICT parsing the output of git diff --name-only master...feature is\n    the intended way of programmatically getting the list of files modified\n    by a feature branch. It is impossible to parse text unless you know what\n    encoding it is in. The output encoding of diff --name-only and diff\n    --name-status was not documented.\n    \n    I asked on the mailing list and got this:\n    https://public-inbox.org/git/YGx2EMHnwXWbp4ET@coredump.intra.peff.net/\n    \n    > There's some discussion in Documentation/i18n.txt, which is included\n    > in various manpages (e.g.,\n    > https://git-scm.com/docs/git-log#_discussion) but it doesn't seem to\n    > be mentioned in git-diff.\n    >\n    > The short answer is: mostly utf8, but historically on platforms that\n    > don't care (like Linux) you could get away with other encodings.\n    >\n    > -Peff\n    \n    My takeaway was to always parse it as utf8 regardless of platform or\n    environment.\n    \n    Changes since v1:\n    \n     * Replace \"always\" with \"usually\"\n     * Add a link to https://git-scm.com/docs/git-log\n     * Replace \"usually\" with \"often\"\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-996%2Fhexagonrecursion%2Futf8-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-996/hexagonrecursion/utf8-v2\nPull-Request: https://github.com/git/git/pull/996\n\nRange-diff vs v1:\n\n 1:  4f1987e5e09c ! 1:  6daa652b7b15 doc: clarify the filename encoding in git diff\n     @@ Commit message\n          doc: clarify the filename encoding in git diff\n      \n          AFAICT parsing the output of `git diff --name-only master...feature`\n     -    is the intended way of programmatically getting the list of files modified\n     +    is the intended way of programmatically getting the list of files\n     +    modified\n          by a feature branch. It is impossible to parse text unless you know what\n          encoding it is in. The output encoding of diff --name-only and\n          diff --name-status was not documented.\n      \n          I asked on the mailing list and got this:\n          https://public-inbox.org/git/YGx2EMHnwXWbp4ET@coredump.intra.peff.net/\n     -    > There's some discussion in Documentation/i18n.txt, which is included in\n     +    > There's some discussion in Documentation/i18n.txt, which is included\n     +    in\n          various manpages (e.g., https://git-scm.com/docs/git-log#_discussion)\n          but it doesn't seem to be mentioned in git-diff.\n          >\n     @@ Documentation/diff-options.txt: explained for the configuration variable `core.q\n       \n       --name-only::\n      -\tShow only names of changed files.\n     -+\tShow only names of changed files. The file names are usually encoded in UTF-8.\n     ++\tShow only names of changed files. The file names are often encoded in UTF-8.\n      +\tFor more information see the discussion about encoding in the linkgit:git-log[1]\n      +\tmanual page.\n       \n       --name-status::\n       \tShow only names and status of changed files. See the description\n       \tof the `--diff-filter` option on what the status letters mean.\n     -+\tJust like `--name-only` the file names are usually encoded in UTF-8.\n     ++\tJust like `--name-only` the file names are often encoded in UTF-8.\n       \n       --submodule[=<format>]::\n       \tSpecify how differences in submodules are shown.  When specifying\n\n\n Documentation/diff-options.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex aa2b5c11f20b..69de49f977b6 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -293,11 +293,14 @@ explained for the configuration variable `core.quotePath` (see\n linkgit:git-config[1]).\n \n --name-only::\n-\tShow only names of changed files.\n+\tShow only names of changed files. The file names are often encoded in UTF-8.\n+\tFor more information see the discussion about encoding in the linkgit:git-log[1]\n+\tmanual page.\n \n --name-status::\n \tShow only names and status of changed files. See the description\n \tof the `--diff-filter` option on what the status letters mean.\n+\tJust like `--name-only` the file names are often encoded in UTF-8.\n \n --submodule[=<format>]::\n \tSpecify how differences in submodules are shown.  When specifying\n\nbase-commit: 48bf2fa8bad054d66bd79c6ba903c89c704201f7\n-- \ngitgitgadget\n"}]}