git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: "Александр Третьяк" <alextretyak2@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Feature request: number of added and deleted lines for UTF-16 files
Date: Mon, 9 Mar 2020 19:35:32 +0100	[thread overview]
Message-ID: <20200309183532.lsh74dxjlxdqhdox@tb-raspi4> (raw)
In-Reply-To: <CACDhn-R6ZKvgMxJdxP7NpsAViY97PfC7aM8xTJgaQK_GLJRyvQ@mail.gmail.com>

On Mon, Mar 09, 2020 at 07:37:56AM +1000, Александр Третьяк wrote:
> Some source files in MSVC (e.g. resource.h) are encoded in UTF-16 (LE)
> with Byte Order Mark (i.e. signature: FF FE for little-endian and FE
> FF for big-endian), and `git diff --numstat` shows `-` in place of
> number of added/removed lines, e.g.:
> -       -       clientapp/resource.h
>
> Can you auto detect UTF-16 by reading first 2 bytes of the file, and
> correctly show number of lines added/removed?

There is an attribute "working-tree-encoding" that can be used to
have the files in "UTF-16LE-BOM" (in your case) in your working tree
and in UTF-8 inside the repo.
This will allow commands like "git diff" to display added/deleted lines
in UTF-8.

More details may be found here:
https://git-scm.com/docs/gitattributes

I hope that helps

      reply	other threads:[~2020-03-09 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACDhn-QHqGFhZw+3K61v+Qtmm5y35nARWJaBkZ_YyZevJu8HBQ@mail.gmail.com>
2020-03-08 21:37 ` Feature request: number of added and deleted lines for UTF-16 files Александр Третьяк
2020-03-09 18:35   ` Torsten Bögershausen [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20200309183532.lsh74dxjlxdqhdox@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=alextretyak2@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).